标签:c
实例1:读写字符文件,每次读取一个字符。
#include<stdio.h>
#include <stdlib.h>
int main()
{
FILE *fpin ;
FILE *fpout;
char c;
fpout=fopen("c:\\dest.txt","wt");
if((fpin=fopen("c:\\test.txt","rt"))!=NULL)
{
c = fgetc(fpin);
while(c!=EOF)
{
fputc(c,fpout);
c=fgetc(fpin);
}
}
else
{
printf("file not exist!");
exit(1);
}
fclose(fpin);
fclose(fpout);
return 0;
}
标签:c
原文地址:http://simoniu.blog.51cto.com/2566344/1409136