[求助]关于文件输入输出问题(不知道错在哪里)
#include<stdio.h>main()
{
int n,i,j,m;
char str[100][100],ch;
FILE *p;
scanf("%d",&n);
if((p=fopen("stu.dat","w+"))==NULL)
{
fprintf(stderr,"´ò¿ª´íÎó");
exit(1);
}
for(i=0;i<n;i++){
gets(str[i]);
fputs(str[i],p);
}
ch=fgetc(p);
while(!feof(p))
{
if(ch>=97&&ch<=122)
ch-=32;
putchar(ch);
ch=fgetc(p);
}
fclose(p);
}
搜索更多相关的解决方案:
include
----------------解决方案--------------------------------------------------------
#include<stdio.h>
main()
{
int n,i,j,m;
char str[100][100],ch;
FILE *p;
scanf("%d",&n);
if((p=fopen("stu.txt","w+"))==NULL)
{
fprintf(stderr,"cuo le");
exit(0);
}
for(i=0;i<n;i++){
gets(str[i]);
fputs(str[i],p);
}
while(feof(p))
{
ch=fgetc(p);
if(ch>=97&&ch<=122)
ch-=32;
putchar(ch);
}
fclose(p);
}
----------------解决方案--------------------------------------------------------