CFile::Remove

Syntax

static void Remove( const char* pszFileName )
throw( CFileException );

Parameters

pszFileName

A string that is the path to the desired file. The path may be relative or absolute, but may not 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 file is connected to an existing open file or if the file cannot be removed. This is equivalent to the MS-DOS del command.

Example

char* pFileName = "test.dat";

TRY

{

CFile::Remove( pFileName );

}

CATCH( CFileException, e )

{

#ifdef _DEBUG

afxDump << "File " << pFileName << " not found\\n";

#endif

}

END_CATCH