C language IO learning

#include <stdio.h>
#include <stdlib.h>

int main(void) {

//	puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */

//	FILE *fp;
//	char ch;
//Check if the file was opened successfully
//	if ((fp = fopen("demo.txt", "w+")) == NULL) {
//		printf("Cannot open file, press any key to exit!\n");
////		getch();
//		exit(1);
//	}

//write character
//	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("Error reading");
	 } else {
	 puts("read success");
	 }*/

//	fclose(fp);
	return EXIT_SUCCESS;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324819661&siteId=291194637