刚学c语言,读取文件中的大写字母,变成小写后输出,弄了一下午也没弄出来,请求指点,谢谢啦
#include<stdio.h>int main()
{
char s[20];
int i;
FILE *fp = fopen("data4.in","r");//data4.in里面存放着一串大写字母
if(fp ==NULL)
{
printf("error");
return 0;
}
{
fscanf(fp,"%s",s);
for(i=0;s[i]!='\0';i++)
if(s[i]>='A' && s<='Z')s[i]+=32;//提示warning:comparison between pointer and integer
printf("%c\t",s[i]);
printf("\n");
fclose(fp);
return 0;
}
}