From: Eric Backus Subject: Re: How to obtain full path name To: kunst AT prl DOT philips DOT nl Date: Tue, 9 Mar 93 16:46:38 PST Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Mailer: Elm [revision: 66.25] > Does anyone know how to obtain the full path name of the current > directory which works on (every) --> UNIX <-- (POSIX preferably) > and therefore also on DJGPP ? I believe that the POSIX answer is: #include char *getcwd(char *buf, size_t size); You pass it a buffer of size bytes, and getcwd() fills in the buffer with the current working directory, and then returns . If something fails (like is too small) the function returns NULL and sets errno. I believe that PATH_MAX bytes should always be big enough to hold the path. Or maybe you need PATH_MAX+1 for the null. I can't remember. Offhand, I don't recall if DJGPP supports this, but I'd bet it does. (If not, please write a getcwd() and send it to the mailing list so it gets into the next release of DJGPP.) Unfortunately, I believe that this is one of those areas where every UNIX system before POSIX did things slightly differently. -- Eric Backus ericb AT lsid DOT hp DOT com (206) 335-2495