读出文件ucase.txt中的内容,将其转换为小写后,显示在屏幕上。
#include <stdio.h>
#include <ctype.h>
int main()
{
FILE* file = fopen("ucase.txt", "r");
if (!file) {
printf("failed to open file\n");
return -1;
}
char ch;
while ((ch = fgetc(file)) != EOF)
putchar(tolower(ch));
return 0;
}