REALPATH

Section: Linux Programmer's Manual (3)
Updated: July 29th 1994
Index Return to Main Contents
 

NAME

realpath - returns the canonicalized absolute pathname.  

SYNOPSIS

#include <sys/param.h>
#include <unistd.h>

char *realpath(char *path, char resolved_path[]);
 

DESCRIPTION

realpath expands all symbolic links and resolves references to '/./', '/../' and extra '/' characters in the null terminated string named by path and stores the canonicalized absolute pathname in the buffer of size MAXPATHLEN named by resolved_path. The resulting path will have no symbolic link, '/./' or '/../' components.  

RETURN VALUE

If there is no error, it returns a pointer to the resolved_path.

Otherwise it returns a NULL pointer and places in resolved_path the absolute pathname of the path component which could not be resolved. The global variable errno is set to indicate the error.  

ERRORS

ENOTDIR
A component of the path prefix is not a directory.
EINVAL
The pathname contains a character with the high-order bit set.
ENAMETOOLONG
A component of a pathname exceeded MAXNAMLEN characters, or an entire path name exceeded MAXPATHLEN characters.
ENOENT
The named file does not exist. EACCES Search permission is denied for a component of the path prefix.
ELOOP
Too many symbolic links were encountered in translating the pathname.
EIO
An I/O error occurred while reading from the file system.
 

SEE ALSO

readlink(2), getcwd(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 12:23:45 GMT, March 22, 2025