CFile::Remove

staticvoidPASCALRemove(LPCTSTRlpszFileName**);**
throw(CFileException);

Parameters

lpszFileName

A string that is the path to the desired file. The path can be relative or absolute but cannot contain a network name.

Remarks

This static function deletes the file specified by the path. It will not remove a directory.

The Remove member function throws an exception if the connected file is open or if the file cannot be removed. This is equivalent to the DEL command.

Example

//example for CFile::Remove
char* pFileName = "test.dat";
TRY
{
    CFile::Remove( pFileName );
}
CATCH( CFileException, e )
{
    #ifdef _DEBUG
        afxDump << "File " << pFileName << " cannot be removed\n";
    #endif
}
END_CATCH

CFile OverviewClass MembersHierarchy Chart