CStdioFile can't open a text file for reading - at a total loss!

  • Thread starter Thread starter Gregary
  • Start date Start date
G

Gregary

Guest
Debug watch:

Name Value Type
lpszFileNameDFX 0x00360e00 "Q:\\Arduino\\CNCLaserEngraver\\ExamplePCB.dfx" const char *



The file Q:\\Arduino\\CNCLaserEngraver\\ExamplePCB.dfx DEFINTIELY exists.



But for some reason that totally escapes me CStdioFile constructor fails to open with an exception stating that the file cannot be found.


Q: is my USB thumb drive. Visual studio has the project open on this same thumb drive.


The file ExamplePCB.dfx is not attributed as 'hidden' or 'system'

Else where in my code I am opening a .bmp file with the same name and same folder (different file extension - .bmp):

m_image.Load(m_strFolder + "\\" + m_strFilenameBMP);


And this bit of code works perfectly fine - the .bmp file opens as expected.


So what is the difference? Why can't CStdioFile opne my .dfx text file in the same location?????

void CGregsLaserEngraverDlg::ProcessDFX(LPCSTR lpszFileNameDFX, CStringArray &arrayFormatted)
{
CStdioFile fileDFX(lpszFileNameDFX, CFile::modeRead | CFile::shareDenyNone);
CString strLine;
UINT32 nWidth = 0, nHeight = 0;

if (fileDFX)
{
while (strLine != "$EXTMAX")
fileDFX.ReadString(strLine);

fileDFX.ReadString(strLine);
fileDFX.ReadString(strLine);
nWidth = atol(strLine);
fileDFX.ReadString(strLine);
fileDFX.ReadString(strLine);
nHeight = atol(strLine);

while (strLine != "ENTITIES")
fileDFX.ReadString(strLine);
fileDFX.ReadString(strLine);

fileDFX.ReadString(strLine);
if (strLine == "POLYLINE")
{
ProcessPolyline(fileDFX, arrayFormatted);
}
}
}

Continue reading...
 
Back
Top