本文整理汇总了C++中VirtualDrive::FileCreate方法的典型用法代码示例。如果您正苦于以下问题:C++ VirtualDrive::FileCreate方法的具体用法?C++ VirtualDrive::FileCreate怎么用?C++ VirtualDrive::FileCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualDrive
的用法示例。
在下文中一共展示了VirtualDrive::FileCreate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
BOOL VirtualFile::Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* /*pError*/)
{
// Open() only works if a VirtualDriveManager is present.
VirtualDriveManager* manager = VirtualDriveManager::GetInstance();
if (!manager)
{
ASSERT(0);
return FALSE;
}
m_strFileName = lpszFileName;
// Parse the incoming filename.
CString virtualDriveName;
CString virtualFileName;
manager->ParseFilename(lpszFileName, virtualDriveName, virtualFileName);
VirtualDrive* drive = manager->Open(virtualDriveName, false);
if (!drive)
return FALSE;
if (nOpenFlags & modeCreate)
{
if (drive->m_readOnly)
return false;
return drive->FileCreate(virtualFileName, *this);
}
return drive->FileOpen(virtualFileName, *this);
}
示例2: LS_VirtualDrive_FileCreate
int LS_VirtualDrive_FileCreate(LuaState* state, LuaStackObject* args)
{
VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
const char* fileName = luaL_checkstring(*state, 2);
UINT compressionLevel = (UINT)luaL_optnumber(*state, 3, 8);
time_t fileTime = (UINT)luaL_optnumber(*state, 4, (lua_Number)time(NULL));
VirtualFileHandle* fileHandle = PushVirtualFileHandleObj(state);
if (!drive->FileCreate(fileName, *fileHandle, compressionLevel, &fileTime))
return 0;
return 1;
}