【C语言】FILE读取文件的'\o'和'\n'。

FILE * fp;
	fp = fopen("11.txt", "w");
	fprintf(fp,"%s\n","hello");
	fprintf(fp,"%c",'\0');
	fprintf(fp,"%c",'\n');
	fprintf(fp,"%s","world");
	fclose(fp);


 

方法如下:

 

ifstream fin;
	char ch ; 
	fin.open( "11.txt" ); //打开文件	

	while( fin.get(ch))
	{		
		printf("%c",ch);
	}
	fin.close();


 

你可能感兴趣的:(c,windows)