文件不懂的地方 请高手指教下
程序代码:#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *a;
char ch,smalet[10];
printf("please input the file name\n");
scanf("%s",smalet);
if((a=fopen(smalet,"w"))==NULL)
{
printf("can't open the file\n");
exit(0);
}
ch=getchar();
ch=getchar(); //if no this line what would be
while(ch!='!')
{
if(ch>=97&&ch<=122)
ch=ch-32;
fputc(ch,a);
putchar(ch);
ch=getchar();
}
putchar('\n');
fclose(a);
return 0;
}
1.这个用‘w'写的文件放在哪?2.在输完所有字符 回车 接下来是不是对每个字符进行处理?
3.每次处理完一个字符后 为什么会自动进行处理下一个字符?例如 我输入abcdef enter后它是先判断第一个字符 完了之后为什么自动进行判断第二个字符b?是不是有getchar() 它会自动检查第二个字符?
4.每次putchar()输出的字符为什么不是在屏幕上,也就是说每进行一次putchar()屏幕就应该有一个字符?那是不是集中处理后再统一输出的?









帮顶吧。
