帮忙看看这关于文件的代码有啥问题 ?
我用VC6.0写了 一个很短的关于文件的程序,但就是输不出来 ??(我先在 桌面上见了一个 "aaa.txt"文档)#include<stdio.h>
void main()
{ FILE *p;
char ph;
if((p=fopen("aaa.txt","w"))==NULL)
{ printf("can't open this file!");
return;
}
printf("Input a string:\n");
ph=getchar();
while(ph!=EOF)
{ fputc(ph,p);
ph=getchar();
}fclose(p);
if((p=fopen("aaa.txt","w"))==NULL)
{ printf("can't open this file!");
return;
}
printf("Output the string:\n");
ph=fgetc(p);
while(ph!=EOF)
{ putchar(ph);
ph=fgetc(p);
}
printf("\n");
fclose(p);
}