2019独角兽企业重金招聘Python工程师标准>>>
#include <stdio.h>
#include <stdlib.h>int main(){FILE *fp;char ch;if((fp=fopen("testfile", "a")) == NULL){fprintf(stderr, "Error opening file.\n",fp);exit(1);}printf("Input a string (Ctrl+D to exit):\n");while((ch=getchar()) != EOF){fputc(ch, fp);}if(ferror(fp)){puts("something wrong to read file\n");}else{puts("write file success!\n");}fclose(fp);printf("\n");return 0;
}