On Tue 2010-02-23 15:12:03 UTC-0000, Jimmy Johnson ([email protected]) wrote:

> Okay I will try that.  
> 
> Does a c executable not read from a default directory?  Say the one in which 
> the executable resides?

"Default directory" is ambiguous.

The C standard itself has no concept of directories.  Not all
platforms do either, eg. some embedded systems may not.

On most operating systems (DOS, Windows, Linux and others) that have a
concept of directories I think you can safely assume that
fopen("robot", ...) in C and its C++ equivalent will open a file named
"robot" in the current working directory (CWD), assuming such a thing
exists for that platform.

For those platforms the CWD can be changed while the program is
running.  It may not necessarily be what you expect it to be when your
program starts.

The POSIX standard specifies a chdir() function to change the CWD, and
a getcwd() function to obtain the pathname of the CWD.

Reply via email to