sprintf函数使用---该函数必须包含include<stdio.h>,strlen必须包含:#include <string.h>
sprintf missing function-prototype :
sprintf函数使用---该函数必须包含include<stdio.h>
sprintf函数使用---该函数必须包含include<stdio.h>
在C51中直接使用printf比自己编个串口发送字符串的函数方便,但有几个问题要注意的。
1. 使用printf之前要先包含stdio.h这个头文件
#include <stdio.h>
具体stdio.h包含的函数见下面网址
http://www.keil.com/support/man/docs/c51/c51_stdio_h.htm
------------------------------------------------------------------------------------------------------------------------------------------------------
strlen
Summary #include <string.h>
int strlen (
char *src); /* source string */
Description The strlen function calculates the length, in bytes, of src. This calculation does not include the null terminating character.
Return Value The strlen function returns the length of src.
See Also strcat, strncat, strncpy
Example #include <string.h>
#include <stdio.h> /* for printf */
void tst_strlen (void) {
char buf [] = "Find the length of this string";
int len;
len = strlen (buf);
printf ("string length is %d\n", len);
}
void tst_strlen (void) {
char buf [] = "Find the length of this string";
int len;
len = strlen (buf);
printf ("string length is %d\n", len);
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/3194/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2010-6-15 11:01
评论列表