GCC and getcwd

Sami Tikka sami.tikka@welho.com
Thu Jan 31 14:56:00 GMT 2002


Francis Harvey wrote:

> I want to find the current directory that the executable file is in,
> so I can open a text file in the same directory.  The executable
> is on the k drive, but my code doesn't return the correct path:

This is not the Unix way to do things. The Unix API does not provide any 
way for a process to find out where its executable image is located (it 
might not exist anymore!) See:
http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC23

-- 
Sami Tikka, sti@iki.fi, http://www.iki.fi/sti/
/* No comment */


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list