Home > Software engineering >  MFC CFile Open failure
MFC CFile Open failure

Time:09-18

With open is created to open failure paths are the same...

CodePudding user response:

File exists? Try using absolute path? Or./Student. Dat directly into Student. Dat?
Again failed DWORD er=GetLastError (); Look at what is the error code

CodePudding user response:

Do not recommend using relative paths, this will cause a lot of uncertain problems!!!
Use absolute paths!!!!!!!!!!

CodePudding user response:

GetModuleFileName application path, plus the file name, a better approach

CodePudding user response:

Is not supported./path
Use the standard "\ " or the full path

CodePudding user response:

The first, both please try to use ". \ \ "to specify the path from the root
The second, I have remember CFile Open have a CException when fail, both please use CException to know the reason

CodePudding user response:

The file path should be https:\\bbs.csdn.net\\topics\\392564497 this format instead of AAA/VVV/

CodePudding user response:

Should be a low-level mistakes, create a file, if in a block of code, do not need to open again, because the file is open, if the other block, in createfile piece, need to close (fp), otherwise the file has been occupied by the fast, other block can't open

CodePudding user response:

Create a file, do not need to open again
  • Related