Resolve a pathname
#include <stdlib.h> char * realpath( const char * pathname, char * resolved_name );
- The path name that you want to resolve.
- NULL, or a pointer to a buffer where the function can store the resolved name.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The realpath() function resolves all symbolic links, extra slash (/) characters and references to /./ and /../ in pathname, and copies the resulting null-terminated absolute pathname into the memory referenced by resolved_name.
This function resolves both absolute and relative paths and returns the absolute pathname corresponding to pathname. All but the last component of pathname must exist when you call realpath().
A pointer to resolved_name, or NULL if an error occurred, in which case resolved_name contains the pathname that caused the problem.
The realpath() function may fail and set the external variable errno to any of the errors specified for the library functions chdir() , close() , fchdir() , lstat() , open() , readlink() and getcwd() .
Last modified: 2013-12-23