Re: Starting directory and fopen("..."), where does it start?
Re: Starting directory and fopen("..."), where does it start?
- Subject: Re: Starting directory and fopen("..."), where does it start?
- From: David Remahl <email@hidden>
- Date: Sat, 22 Dec 2001 04:11:58 +0100
>
Hi there,
>
I'm just porting one of the Nehe tutorials to Mac OS X, and I
>
have already fixed pretty much everything, except that fopen()
>
doesn't seem to find the files. :/
>
The file is physically in the build directory, inside the Data
>
directory, that is right next to the app, but still fopen
>
doesn't find.
>
>
#define MODEL_FILE "Data/model.txt"
>
>
FILE *In = fopen (MODEL_FILE, "rb");
>
>
Question: what did I do wrong? ;)
>
>
Thanks,
>
Alex.
The problem is that the finder does not set up the working directory to
anywhere you could/should predict...Either you have to use an absolute path,
or you should chdir() to the resources directory of your bundle for example,
and put the DATA-files in there, and then set up the working directory
accordingly.
/ david