_fullpath
Convert a path name from relative to absolute.
Defined in header <stdlib.h>
Syntax
#include <stdlib.h>
char * _fullpath(char *buffer, const char *path,intbuflen);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
_fullpath converts the relative path name in path to an absolute path name that is stored in the array of characters pointed to by buffer. The maximum number of characters that can be stored at buffer is buflen. The function returns NULL if the buffer isn't big enough to store the absolute path name, or if the path contains an invalid drive letter.
If buffer is NULL, the Jullpath allocates a buffer of up to _MAX_PATH characters. This buffer should be freed using free when it is no longer
| needed. _MAX_PATH | is defined in stdlib.h |
Return value
If successful, the _fullpath function returns a pointer to the buffer containing the absolute path name. Otherwise, it returns NULL.
See also
Example
#include <stdio.h>
#include <stdlib.h>
void main(int argc, char *argv[])
{
char buf [_MAX_PATH];
for ( ; argc; argv++, argc--) {
if (_fullpath(buf, argv[0], _MAX_PATH) == NULL)
printf ("Unable to obtain full path of %s\n" ,argv[0]);
else
printfC'Full path of %s is %s\n",argv[0] ,buf) ;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdlib.h/_fullpath/
· short form /3.1/_fullpath/