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

📄 index067.htm

📁 一本不错的VC编程的参考书
💻 HTM
字号:
<html>
<style type="text/css"><!--
.p9 {  font-family: "宋体"; font-size: 9pt}a        {text-transform: none; text-decoration: none;}
a:hover {text-decoration: underline; color: #FF0000;}
--></style>
<body background="../di2001.jpg">
<h3 align="center"><font COLOR="#AOAO99"></font></h3>
<table width="100%" border="1" cellspacing="1">
<tr><td><p align="center"><font color="#FF0000">在哪儿创建临文件</font></td></tr>
<tr><td><p>
</Br>
调用SDK函数GetTemPath可以确定临时文件的目录,该函数首先为临时路径检测TMP环境变量:如果没有指定TMP,检测TMP环境变量,然后返回到当前目录。下例说明了如何创建一个临时文件。<Br>
</Br>
…<Br>
&nbsp;//get unique temporary file.<Br>
&nbsp;CString strFile<Br>
&nbsp;GetUniqueTempName (strFile)<Br>
&nbsp;TRY<Br>
&nbsp;{<Br>
&nbsp;//Create file and write data.Note that file is closed<Br>
&nbsp;//in the destructor of the CFile object.<Br>
&nbsp;CFile file (strFile,CFile ::modeCreate | CFile:: modeWrite)<Br>
</Br>
&nbsp;//write data<Br>
&nbsp;}<Br>
</Br>
&nbsp;CATCH (CFileException, e)<Br>
&nbsp;{<Br>
&nbsp;//error opening file<Br>
&nbsp;}<Br>
&nbsp;END_CATCH<Br>
…<Br>
</Br>
Void GetuniqueTempName (CString& strTempName)<Br>
{<Br>
&nbsp;//Get the temporary files directory.<Br>
&nbsp;TCHAR szTempPath [MAX_PATH]<Br>
&nbsp;DWORD dwResult=:: GetTempPath (MAX_PATH, szTempPath)<Br>
&nbsp;ASSERT (dwResult)<Br>
</Br>
&nbsp;//Create a unique temporary file.<Br>
&nbsp;TCHAR szTempFile [MAX_PATH]<Br>
&nbsp;UINT nResult=GetTempFileName (szTempPath, _T ("~ex"),0,szTempfile)<Br>
&nbsp;ASSERT (nResult)<Br>
</Br>
&nbsp;strTempName=szTempFile<Br>
}<Br>
</Br>
</p></td></tr>
</table>
</body></html>

⌨️ 快捷键说明

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