TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: William McBrine
date: 2003-05-27 19:15:12
subject: Re: Linux and GCC

-=> Neil Heller wrote to Darin McBride <=-

 NH> Which bring another question to mind.  If I write a program that
 NH> prompts the user for a file name, and then pass that name directly to
 NH> fopen() must that file name have "./" prepended if the
target file is
 NH> in the same directory as the executable and that directory is not in
 NH> the path?

No no no no no. Launching an executable from the command line, and using
fopen() in a program, are entirely different things. fopen() doesn't
operate based on the PATH; why would it? It's also got nothing to do with
the directory where the executable happens to be. Rather, it works on the
_current_ directory; i.e., where _you_ were when you _started_ the
executable, if the current directory hasn't been changed from within the
program itself.

fopen() in Unix works exactly the same as it does in DOS. (Not
surprisingly, since it's an ANSI standard function.) And incidentally,
launching a program from the command line also works exactly the same in
Unix as it does in DOS, _except_ for the implicit "." at the start of DOS'
PATH.

... Sturgeon's Law: 95% of everything is crap.
--- MultiMail/Linux v0.44
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.