Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading files

Status
Not open for further replies.

Berras

Programmer
Feb 24, 2002
42
GB
I am having trouble reading files. I can open the file O.K. but when I try to read the file, file.Read(myfile,5), it runs the program but then it comes up with a Visual C++ debug error. HELP!!
 
If Your buffer myfile is not shorter as 5 Bytes, this error can appears if You make
file.Close();
after You do not need the File more. It is a bug of CFile, I think, destructor of the CFile does not allways check if the File was closed and tries to close it itself. Try to remove Your file.Close() - function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top