|
[code:1]
......
....
#ifdef __USE_BSD
/* If BUF is NULL, make STREAM unbuffered.
Else make it use SIZE bytes of BUF for buffering. */
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
size_t __size) __THROW;
/* Make STREAM line-buffered. */
extern void setlinebuf (FILE *__stream) __THROW;
#endif
........
.......
[/code:1]
如上是我在linux 9 /usr/include/stdio.h 里复制的一段代码,当我用程序调用setbuffer() 函数时(程序如下:)
[code:1]
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char buf[1024];
FILE *fp;
if((fp=fopen("setbuf","wb+"))==NULL){
perror("fopen");
exit(EXIT_FAILURE);
}
setbuffer(fp,buf,1024);
fclose(fp);
exit(EXIT_SUCCESS);
}
[/code:1]
用gcc -Wall -ggdb -o test test.c 编译得到下面警告:
test.c: In function `main':
test.c:13: warning: implicit declaration of function `setbuffer'
求助,我怎能才能正确调用 setbuffer()。
同样问题,有 #ifdef __USE_BSD .................#endif 包含的函数我用都编不过
有劳各位
|
|