Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 1999 16:43:39 +0000 (GMT)
From:      Jonathon McKitrick <jcm@dogma.freebsd-uk.eu.org>
To:        Greg Lehey <grog@lemis.com>
Cc:        rover@lglobus.ru, freebsd-questions@freebsd.org
Subject:   Re: Is there correct way for program to read from itself?
Message-ID:  <Pine.BSF.4.02A.9911191643160.22999-100000@dogma.freebsd-uk.eu.org>
In-Reply-To: <19991119113720.28959@mojave.sitaranetworks.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ah, makes perfect sense.  Thanks.

On Fri, 19 Nov 1999, Greg Lehey wrote:
>  main (int argc, char *argv [])
>  {
>    int me = open (argv [0], O_RDONLY);
> 
>argv [0] gets set to the name of the program (copyme).  If I start it
>via PATH, it's still just "copyme".  open(2) will fail if it doesn't
>find it in the current directory, and worse, if it *does* find a file
>of the same name, it will open it instead of the correct file.
>
>Greg
>--
>When replying to this message, please copy the original recipients.
>For more information, see http://www.lemis.com/questions.html
>Finger grog@lemis.com for PGP public key
>See complete headers for address and phone numbers
>


-jm

---------
He who laughs last... obviously didn't get the joke.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.02A.9911191643160.22999-100000>