FileSys::Unlink( Error * )
Remove the file specified by the path
protected
FileSys
member from the filesystem.
Virtual? |
Yes |
|
Class |
||
Arguments |
|
returned error status |
Returns |
|
Notes
The default implementation of Unlink()
is always called
if the file created is temporary.
Your implementation must correctly report any system errors that might occur during removal.
Example
To use Unlink()
to delete
an old log file:
FileSys *f = FileSys::Create( FST_TEXT ); Error e; f->Set( "/usr/logs/oldlog" ); f->Unlink( &e );
To reimplement Unlink()
to report errors with Error::Sys()
and provide
debugging output:
void FileSysDemo::Unlink( Error *e ) { if ( unlink( Name() ) < 0 ) e->Sys( "unlink", Name() ); if ( DEBUG ) printf( "Debug (Unlink): %s\n", Name() ); }