home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3238 < prev    next >
Encoding:
Internet Message Format  |  1991-04-24  |  1.1 KB

  1. From: pt@geovision.gvc.com (Paul Tomblin)
  2. Newsgroups: alt.sources,comp.unix.programmer,comp.os.vms
  3. Subject: Re: Relative path to Absolute Path
  4. Message-ID: <1515@geovision.gvc.com>
  5. Date: 23 Apr 91 18:32:15 GMT
  6.  
  7. pt@geovision.gvc.com (Paul Tomblin) writes:
  8.  
  9. >Does anybody have a routine to go from a relative file (or directory)  path to
  10. >an absolute (rooted) one?  I need one for both unix and vms.  I need to be
  11. >able to go from relative to absolute in the following cases:
  12.  
  13. Although I got absolutely zero response to this request, I did find an
  14. answer.  With the error checking turned off, what I ended up doing was
  15. approximately this:
  16.  
  17.     chdir(new_dir);
  18.     getcwd(new_dir, MAX_PATH_LEN);
  19.  
  20. It works beatifully, on both VMS and unix.  (And probably DOS, but
  21. I wouldn't bet my life on it.)
  22.  
  23. -- 
  24. Paul Tomblin, Department of Redundancy Department.       ! My employer does 
  25. Two roads diverged in a wood, and I/ I took the one less ! not stand by my
  26. travelled by/ And that is why I'm lost, dammit...        ! opinions.... 
  27. pt@geovision.gvc.com or {cognos,uunet}!geovision!pt      ! Me neither.
  28.