stdio文件函数详解(4)
发布时间:2021-06-07
发布时间:2021-06-07
stdio文件常用函数
#include <stdio.h>
#include <conio.h>
#include <io.h>
void flush(FILE *stream);
int main()
{
FILE *stream;
char msg[]="This is a test";
stream=fopen("DUMMY.FIL","w");
fwrite(msg,strlen(msg),1,stream);
clrscr();
printf("Press any key to flush DUMMY.FIL:");
getch();
flush(stream);
printf("File was flushed,Press any key to quit:");
getch();
return 0;
}
void flush(FILE *stream)
{
int duphandle;
fflush(stream);
duphandle=dup(fileno(stream));
close(duphandle);
}
上一篇:第三章 网络危机的应对策略