delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/01/31/17:56:38

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3C59CB7A.6000202@welho.com>
Date: Fri, 01 Feb 2002 00:55:54 +0200
From: Sami Tikka <sami DOT tikka AT welho DOT com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.7) Gecko/20011221
X-Accept-Language: en-us
MIME-Version: 1.0
To: Francis Harvey <HARVEYF1 AT WESTAT DOT com>
CC: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: GCC and getcwd
References: <08B08C9FA5EBD311A2CC009027D5BF81032B0F9E AT remailnt2-re01 DOT westat DOT com>

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 AT iki DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019