#include <stdio.h> #include <stdlib.h> int main(void) { // puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */ // FILE *fp; // char ch; //判断文件是否成功打开 // if ((fp = fopen("demo.txt", "w+")) == NULL) { // printf("Cannot open file, press any key to exit!\n"); //// getch(); // exit(1); // } //写入字符 // for (char cc = 37; cc < 127; cc++) { // // fputc(cc, fp); //// if (cc == 122) //// fputc(EOF, fp); // putchar(cc); // } // fclose(fp); // if ((fp = fopen("demo.txt", "w+")) == NULL) { // printf("Cannot open file, press any key to exit!\n"); //// getch(); // exit(1); // } // int i = 0; // while ((ch = fgetc(fp)) != EOF) { // putchar(ch); //// ++i; // } // printf("%d",i); /* if (ferror(fp)) { puts("读取出错"); } else { puts("读取成功"); }*/ // fclose(fp); return EXIT_SUCCESS; }
C语言IO学习
猜你喜欢
转载自blog.csdn.net/u013445609/article/details/80078695
今日推荐
周排行