文本文件处理问题 帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/05/28 05:28:23
现在我有两个文件in.txt out.txt 我想把IN 中的内容COPY到OUT中 小弟现在写的程序怎么都不行
#include <stdio.h>
#include <process.h>
void main(void)
{
FILE *in,*out;
if((in=fopen("d:\\C\\C100\\06版南开上机100题\\in.txt","r"))==NULL)
{
printf("canot open the file\n");
exit(0);
}
if((out=fopen("d:\\C\\C100\\06版南开上机100题\\out.txt","w"))==NULL)
{
printf("canot open the file\n");
exit(0);
}
if(!feof(in))
fputc(fgetc(in),out);//这种不行
fread(in,6,1,out);//这个也不行
fclose(in);
fclose(out);
}

if(!feof(in)) {
fputc(fgetc(in),out);//这种不行
}
fclose(in);
fclose(out);

这样是可以的呀。
不过不明白你为什么要包括 process.h 这个文件。
这些函数都只要 stdio.h 就可以了的