Home > Software engineering >  Ask: Cfile Close () will be prompted to * * *. Exe has triggered a breakpoint.
Ask: Cfile Close () will be prompted to * * *. Exe has triggered a breakpoint.

Time:09-29

The code is as follows:
CFile InputFile;
if(! InputFile. Open (strFileName CFile: : modeRead)) {
MessageBox (_T (" Failed to open input file!" ));
}
FileLen=(int) InputFile. GetLength ();
ReadTimes=iArrySize/FileLen;//the number of need to read the file
for(int i=0; i{
InputFile. Read (pDataTmp FileLen);
PDataTmp +=FileLen;
InputFile. SeekToBegin ();
}
FileResSize=iArrySize - ReadTimes * FileLen;
If (FileResSize!=0)
{
InputFile. Read (pDataTmp FileResSize);
}
InputFile. Close ();//is the single step this step occurs trigger breakpoints
Also, I need a loop to read file, but read data for the first time is right, and then there is a lot of 0,
O great god answer,,,,

CodePudding user response:

"Read out the data of first is right"
InputFile. Read (pDataTmp FileLen);
The file pointer has to end, want to re-read the beginning must seek to file,
  • Related