Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# FileSys::Unlink( Error * )

Remove the file specified by the `path` protected `FileSys` member from the filesystem.

Virtual? | Yes |
Class | `FileSys` |
Arguments | `Error *error` | returned error status
Returns | `void` |

## 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:

Copy

    FileSys *f = FileSys::Create( FST_TEXT );
    Error e;

    f-&gt;Set( "/usr/logs/oldlog" );
    f-&gt;Unlink( &amp;e );

To reimplement `Unlink()` to report errors with `Error::Sys()` and provide debugging output:

Copy

    void FileSysDemo::Unlink( Error *e )
    {
        if ( unlink( Name() ) &lt; 0 )
            e-&gt;Sys( "unlink", Name() );

        if ( DEBUG )
            printf( "Debug (Unlink): %s\n", Name() );
    }

Your search for returned results