Posted on 2007-03-28 17:16
宋鹏 阅读(3304)
评论(0) 编辑 收藏 引用 所属分类:
Evc Debug Code
//SP-A1用CFile来创建文件
CFile file;
if(file.Open(L"test1.TXT",CFile::modeReadWrite))
{
MessageBox(L"Open File OK");
}
else
{
file.Open(L"test1.TXT",CFile::modeCreate | CFile::modeReadWrite);
MessageBox(L"File not exist to create");
}
/*
//SP-A2创建文件2用CreateFile创建文件
HANDLE g_hFile = 0; // Handle to the opened file
g_hFile = CreateFile(L"test.txt",GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
*/