Re: Problems with fstream
Re: Problems with fstream
- Subject: Re: Problems with fstream
- From: Jens Alfke <email@hidden>
- Date: Mon, 9 Jun 2008 19:41:36 -0700
On 9 Jun '08, at 6:26 PM, Paulo Ferreira wrote:
I tried to chage the pontos.txt to pontos.cpp, but it didn't work
=P ... yes, the pontos.txt and pontos.cpp are in the project.
SO, does someone has any idea how to solve this problem?
Your code is making the assumption that at runtime the current
directory is set to the directory that pontos.txt is in. There's no
reason this needs to be the case. You should be using absolute paths
when opening files.
If your target builds some type of bundle, then you should use
CFBundle or NSBundle APIs to locate the resource file.
If not (i.e. it's a command-line tool) then you have to take into
account that the CWD could be set to any arbitrary path when the
binary is launched. The general way to find the location of the binary
is to look at the directory of argv[0]. The resource file will, I
believe, be copied to the same directory as the executable.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden