释义 |
CFile::Remove
static void PASCAL Remove(LPCTSTR lpszFileName); throw(CFileException);
参数:lpszFileName | 表示所需文件的路径字符串。路径可为相对或绝对,但不可包含网络名。 |
说明: 此静态函数删除由路径指定的文件,但不可移去一个目录。 如果相关联的文件打开或文件不可移去,则函数产生一个异常,它等价于DEL命令。
示例: // example for CFile::Remove char* pFileName ="test.dat"; TRY { CFile::Remove(pFileName); }
CATCH(CFileException,e) { #ifdef _DEBUG afxDump <<"File"<<pFileName<<"cannot be removed\"; #endif } END_CATCH |