[TUHS] Also, relative to absolute pathnames?

Steve Nickolas via TUHS tuhs at tuhs.org
Fri Jun 26 07:43:14 AEST 2026


On Fri, 26 Jun 2026, Warren Toomey via TUHS wrote:

> On a related note, is there a C function (or do you have source code) to
> convert a relative pathname to an absolute one?
>
> e.g.
>
> // Given the current working directory and
> // a pathname, return an absolute pathname
> // with all '..' removed.
> char *relpath_to_abs(char *cwd, char *path);
>
> Before I try to write one I thought I'd ask around :-)
>
> Thanks, Warren
>

Maybe realpath(), but outside of Posix or 4.4, it's not standard.

-uso.


More information about the TUHS mailing list