C语言简单的文件操作为何老是输出乱码
#include<stdio.h>void main(){ FILE *f; char c; printf("INPUT DATA:"); f = fopen("INPUT","w"); while((c=getchar() != EOF)) { putc(c,f); } fclose(f); printf("DATA OUTPUT:"); f = fopen("INPUT","r"); while((c=getc(f) != EOF)) { printf("%c",c); } fclose(f);} 1 #include <stdio.h> 2 int main() 3 { 4 FILE *f; 5 char c; 6 printf("INPUT DATA:"); 7 f = fopen("INPUT","w"); 8 while((c=getchar()) != EOF) //这里 9 { 10 putc(c,f); 11 } 12 fclose(f); 13 printf("DATA OUTPUT:"); 14 f = fopen("INPUT","r"); 15 while((c=getc(f)) != EOF)//这里 16 { 17 printf("%c",c); 18 } 19 fclose(f); 20 21 return 1; 22 }