• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Starting directory and fopen("..."), where does it start?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Cross platform Cocoa/Obj-C
      • From: Brian Hook <email@hidden>
References: 
 >Starting directory and fopen("..."), where does it start? (From: Alexandre Aybes <email@hidden>)

  • Prev by Date: Starting directory and fopen("..."), where does it start?
  • Next by Date: Cross platform Cocoa/Obj-C
  • Previous by thread: Starting directory and fopen("..."), where does it start?
  • Next by thread: Cross platform Cocoa/Obj-C
  • Index(es):
    • Date
    • Thread