void main()
{ FILE *fp;
char str[100]; int i=0;
if((fp=fopen("test.txt","wt"))==NULL)
{ printf("can't open this file.\n");
exit(0);
}
printf("input a string:\n");
gets(str);
while (str[i])
{ if(str[i]>='a'&&str[i]<='z')
str[i]=str[i]-32;
fputc(str[i],fp);
i++;
}
fclose(fp);
fp=fopen("test.txt","rt");
fgets(str,100,fp);
printf("%s\n",str);
fclose(fp);
}