CStdioFile无法打开文本文件进行阅读 - 完全丢失! [英] CStdioFile can't open a text file for reading - at a total loss!
问题描述
调试监视:
文件Q:\\Arduino \\ CNCLaserEngraver \\ExamplePCB.dfx确实存在。
The file Q:\\Arduino\\CNCLaserEngraver\\ExamplePCB.dfx DEFINTIELY exists.
但由于某种原因完全逃脱了我,CStdioFile构造函数无法打开,但发现该文件无法找到。
But for some reason that totally escapes me CStdioFile constructor fails to open with an exception stating that the file cannot be found.
问:是我的USB拇指驱动器.Visual studio在同一个拇指驱动器上打开了项目。
Q: is my USB thumb drive. Visual studio has the project open on this same thumb drive.
文件ExamplePCB.dfx未归类为"隐藏"或"系统"
The file ExamplePCB.dfx is not attributed as 'hidden' or 'system'
否则在我的代码中我打开一个.bmp具有相同名称和相同文件夹的文件(不同的文件扩展名 - .bmp):
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);
m_image.Load(m_strFolder + "\\" + m_strFilenameBMP);
这段代码完全正常 - .bmp文件按预期打开。
And this bit of code works perfectly fine - the .bmp file opens as expected.
那有什么区别?为什么不能CStdioFile o将我的.dfx文本文件放在同一位置?????
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);
}
}
}
推荐答案
你尝试过其他工具吗?例如,从Watch窗口复制路径,然后将其粘贴到记事本的"打开文件"对话框中。
< span lang ="EN-GB"style ="margin:0px"> 也许它应该是".dxf"?
这篇关于CStdioFile无法打开文本文件进行阅读 - 完全丢失!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!