临时文件创建及使用函数
来源:互联网 发布:淘宝网黄金生命胶囊 编辑:程序博客网 时间:2024/05/29 03:28
//创建临时文件
void OnCreateTempFile()
{
//get unique temporary file.
CString strFile;
GetuniqueTempName (strFile);
TRY
{
//Create file and write data.Note that file is closed
//in the destructor of the CFile object.
CFile file (strFile,CFile:: modeCreate | CFile:: modeWrite);
//write data
file.Write("temp",10);
file.Close();
}
CATCH (CFileException, e)
{
//error opening file
}
END_CATCH
void OnCreateTempFile()
{
//get unique temporary file.
CString strFile;
GetuniqueTempName (strFile);
TRY
{
//Create file and write data.Note that file is closed
//in the destructor of the CFile object.
CFile file (strFile,CFile:: modeCreate | CFile:: modeWrite);
//write data
file.Write("temp",10);
file.Close();
}
CATCH (CFileException, e)
{
//error opening file
}
END_CATCH
}
//获得临时文件的完整路径
void GetuniqueTempName(CString &strTempName)
{
//Get the temporary files directory.
TCHAR szTempPath [MAX_PATH];
DWORD dwResult=:: GetTempPath (MAX_PATH, szTempPath);
ASSERT (dwResult);
//Create a unique temporary file.
TCHAR szTempFile [MAX_PATH];
UINT nResult=GetTempFileName (szTempPath, _T ("~ex"),0,szTempFile);
ASSERT (nResult);
strTempName=szTempFile;
}
- 临时文件创建及使用函数
- 创建和使用临时文件
- 使用VB.NET创建临时文件
- c下创建临时文件mkstemp函数
- c下创建临时文件mkstemp函数
- c下创建临时文件mkstemp函数
- 创建临时文件
- 创建临时文件
- 创建临时文件
- 创建临时文件
- Linux:使用mktemp创建临时文件/目录
- 使用临时文件
- Linux中临时文件创建函数mkstemp的用法
- Linux中临时文件创建函数mkstemp的用法
- PHP 使用tempnam保存临时文件,而不是自己维护临时文件的创建和删除
- C# 创建临时文件
- java创建临时文件
- tmpfile创建临时文件
- 查找整个数据库里某个字段在哪些表里
- 数组的循环右移
- IE 打開文件亂碼 等
- IIS 配置问题 一些iis常见问题的解决方法
- Java-What is the difference between <? super E> and <? extends E>?
- 临时文件创建及使用函数
- 英文标点符号使用和意义
- sqlPlus页面乱码
- 唯美伤感个性日志推荐:有一种美因距离而产生
- Hadoop常用命令
- Hadoop 參數設定 – mapred-site.xml
- ArcGIS for iOS 开发系列(6) – 基础篇-图层-动态图层
- 按位反转字符问题
- 我的第十四个c++上机任务(利息计算器)