- /* Note that the behaviour if new file exists is implementation-defined.
- There is nothing wrong with either overwriting it or failing the
- operation, but you might want to document whichever you chose.
- This example fails if new file exists.
- */
- if ( link( old, new ) == 0 )
- {
- return unlink( old );
- }
- else
- {
- return -1;
- }