Prev, Top Notes, Next

Using the Library

if (rename(old_path, new_path) < 0)
{
    int err = errno;
    ...error recovery...
    fprintf(stderr, "rename %s %s: %s\n",
        old_path, new_path, strerror(err));
    exit(1);
}
 
if (rename(old_path, new_path) < 0)
{
    int err = errno;
    ...error recovery...
    fprintf(stderr, "%s\n",
        explain_errno_rename(err, old_path,
            new_path));
    exit(1);
}