⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_20364.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:20364 发表者:祥子_林 发表日期:2002-11-05 21:52:26
<br>主题:help me !!!
<br>内容:try<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;CFile file;<BR>&nbsp;&nbsp;&nbsp;&nbsp;char* pathname="e:\\lin\\lin.in";<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;file.Open(pathname,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyNone);<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDoc-&gt;lpszString="hello";<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDoc-&gt;OnSaveDocument(pathname);///出错于此<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;catch(CFileException* e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e-&gt;ReportError();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e-&gt;Delete();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>////////////////////////////<BR>///////////////<BR>void CTrojanDoc::Serialize(CArchive& ar)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (ar.IsStoring())<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ar&lt;&lt;lpszString;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ar&gt;&gt;lpszString;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR><BR>以上为部分代码,运行时显示“存取e:\\lin\\lin.in时发生共享违例”,不知道是为什么,很是郁闷,请哪位朋友指教。多谢!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:口水龙 回复日期:2002-11-05 21:55:09
<br>内容:file.Open(pathname,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyNone);<BR>??已经打开文件并禁止共享访问了。<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDoc-&gt;lpszString="hello";<BR>&nbsp;&nbsp;&nbsp;&nbsp;pDoc-&gt;OnSaveDocument(pathname);///出错于此//这里你是调用了Serialize吧,你前面已经打开了文件还禁止共享,着时候还想序列化当然回出错,把open那句删了
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:祥子_林 回复日期:2002-11-05 22:01:59
<br>内容:CFile::shareDenyNone&nbsp;&nbsp; Opens the file without denying other processes read or write access to the file. Create fails if the file has been opened in compatibility mode by any other process.<BR>我没有禁止共享啊,我第一次这样用,谢谢<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:祥子_林 回复日期:2002-11-05 22:15:54
<br>内容:可以!!就是不太理解。多谢啦!!!
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -