Is there a way to get the real path (i.e. an absolute path without any '/../
', '/./
' sequences, symbolic links etc.) from a file handle? I know POSIX has the realpath()
function but this doesn't accept a file handle. It uses a file name (string) instead. I'd need a function that accepts an stdio FILE*
handle allocated by fopen()
or a file descriptor allocated by open()
and returns the real path of this file.
Does something like this exist? Or is there any other way to get a fully qualified path from a FILE*
handle or POSIX file descriptor?