Why MFC reads the text file, reads all the data is zero?
Time:09-15
Void CMy0823Dlg: : loadMap (int iMissionNum) {cstrings STR. STR. The Format (" [% d] ", iMi ssi onNum); The FILE * pFile; Fopen_ s (& amp; PFile, "map. TXT", "rb"); If (pFile==NULL) return ;
Char cTmp [20]. The fgets (cTmp, 20, pFile); While (STRNCMP (cTmp, STR, 3)!=0) The fgets (cTmp, 20, pFile);
For (inti=0; i<14. I + t) The fgets (m_ cMap [I], 20, pFile); The fclose (pFile); }
Also, the middle cTmp defined what's the use? The code on the net, have a problem with my in my program, small white sincerely ask,
CodePudding user response:
To set breakpoints, watching to see if the file open? "Rb" (bin) into "rt" (TXT) try Open to check the original file format is in accordance with the norms such as application UltraEdit