This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC and getcwd


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]