FILE* fout = fopen("hello.txt","w"); //a+可是在文本后继续写入,不删除原有信息 fprintf(fout,"%d %d %d\n",height,width,err); fclose(fout);