读数据
谁可以帮我写一个程序读取文件里的20个以上字符及存取
#include"stdio.h"
#include"stdlib.h"
#define null 0
#include"conio.h"
void main()
{
FILE *in,*out;
char infile[20];
char outfile[30]="D:\\programe\\13.txt";
printf("enter the infile name\n");
scanf("%s",infile);
if((in=fopen(infile,"r"))==null)
{
printf("can not open infile");
exit(0);
}
if((out=fopen(outfile,"w"))==null)
{
printf("can not open outfile");
exit(0);
}
while(!feof(in))
fputc(fgetc(in),out);
fclose(in);
fclose(out);
getch();
}
将上面的程序修改一下就可以适合你那个问题了。