delorie.com/djgpp/doc/libc/libc_649.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <stdlib.h> void realpath(const char *in_path, char *out_path); |
This function canonicalizes the input path in_path and stores the result in the buffer pointed to by out_path.
The path is canonicialized by removing consecutive and trailing slashes, making the path absolute if it's relative by prepending the current drive letter and working directory, removing "." components, collapsing ".." components, adding a drive specifier if needed, and converting all slashes to '/'. DOS-style 8+3 names of directories which are part of the pathname, as well as its final filename part, are returned lower-cased in out_path, but long filenames are left intact. See section _preserve_fncase, for more details on letter-case conversions in filenames.
Since the returned path name can be longer than the original one, the
caller should ensure there is enough space in the buffer pointed to by
out_path. Use of ANSI-standard constant FILENAME_MAX
(defined on `stdio.h') or Posix-standard constant PATH_MAX
(defined on `limits.h') is recommended.
If successful, a pointer to the result buffer is returned. Otherwise,
NULL
is returned and errno
is set to indicate which error
was detected.
ANSI/ISO C | No |
POSIX | 1003.2-1992; 1003.1-2001 |
char oldpath[100], newpath[PATH_MAX]; scanf("%s", oldpath); realpath(oldpath, newpath); printf("that really is %s\n", newpath); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |