Relative path to Absolute Path

Paul Tomblin pt at geovision.gvc.com
Wed Apr 24 04:32:15 AEST 1991


pt at geovision.gvc.com (Paul Tomblin) writes:

>Does anybody have a routine to go from a relative file (or directory)  path to
>an absolute (rooted) one?  I need one for both unix and vms.  I need to be
>able to go from relative to absolute in the following cases:

Although I got absolutely zero response to this request, I did find an
answer.  With the error checking turned off, what I ended up doing was
approximately this:

	chdir(new_dir);
	getcwd(new_dir, MAX_PATH_LEN);

It works beatifully, on both VMS and unix.  (And probably DOS, but
I wouldn't bet my life on it.)

-- 
Paul Tomblin, Department of Redundancy Department.       ! My employer does 
Two roads diverged in a wood, and I/ I took the one less ! not stand by my
travelled by/ And that is why I'm lost, dammit...        ! opinions.... 
pt at geovision.gvc.com or {cognos,uunet}!geovision!pt      ! Me neither.



More information about the Comp.unix.programmer mailing list