T
tangzwei
Unregistered / Unconfirmed
GUEST, unregistred user!
在VC++6.0中<br>出现一怪问题,明明已经创建了这个文件,可就是得不到这个文件的句柄。<br>下段代码的结果是:文件创建了,newhandle=INVALID_HANDLE_VALUE ,WriteBytes=0<br>请各位富翁看看,能说出问题,马上给分。<br><br> CHAR filename[200] ;<br> DWORD WriteBytes;<br> HANDLE newhandle ;<br> LPTSTR filestr ;<br><br> filestr="E://MNaa.txt" ;<br> //lstrcpy(filename,"E://MNaa.txt") ;<br><br> newhandle=CreateFile(filestr,GENERIC_WRITE, <br> FILE_SHARE_READ, <br> NULL, <br> OPEN_ALWAYS,<br> FILE_ATTRIBUTE_ARCHIVE, <br> NULL <br> );<br> <br> if (newhandle=INVALID_HANDLE_VALUE) <br> {<br> WriteBytes=GetLastError();<br> m_sprocess.Format( TEXT(" faile %d "),WriteBytes);<br> }<br> else<br> m_sprocess=" ok ";<br> UpdateData(false) ;