delorie.com/djgpp/doc/libc/libc_661.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

_rename

Syntax

 
#include <stdio.h>

int _rename(const char *oldname, const char *newname);

Description

This function renames an existing file or directory oldname to newname. It is much smaller that rename (see section rename), but it can only rename a directory so it stays under the same parent, it cannot move directories between different branches of the directory tree. This means that in the following example, the first call will succeed, while the second will fail:

 
_rename("c:/path1/mydir", "c:/path1/yourdir");
_rename("c:/path1/mydir", "c:/path2");

On systems that support long filenames (see section _use_lfn), _rename can also move directories (so that both calls in the above example succeed there), unless the `LFN' environment variable is set to n, or the _CRT0_FLAG_NO_LFN is set in the _crt0_startup_flags variable, See section _crt0_startup_flags.

If you don't need the extra functionality offered by rename (which usually is only expected by Unix-born programs), you can use _rename instead and thus make your program a lot smaller.

Return Value

Zero on success, nonzero on failure.

Portability

ANSI/ISO C No
POSIX No


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004