Advertisement

07.19.2008 at 11:46AM PDT, ID: 23579335
[x]
Attachment Details

File I/O

Asked by smithdale87 in Apple Programming, Objective-C Programming Language, Cocoa Programming Language

Tags: objective c

I'm having trouble reading a text file when I use it's relative path name instead of the absolute path.

(See code Below)

I'm not sure why this is not working, but it is the most annoying thing ever!
What am I doing wrong?Start Free Trial
1:
2:
3:
4:
5:
6:
// does not work
NSString *fileContents = [NSString stringWithContentsOfFile:@"myFile.txt" encoding:NSUTF8StringEncoding error:NULL];  
 
 
//works
NSString *fileContents = [NSString stringWithContentsOfFile:@"/Users/myProfile/Desktop/myFile.txt" encoding:NSUTF8StringEncoding error:NULL];
[+][-]07.19.2008 at 12:58PM PDT, ID: 22043530

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.19.2008 at 01:04PM PDT, ID: 22043542

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.19.2008 at 01:16PM PDT, ID: 22043565

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 01:03AM PDT, ID: 22044916

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 03:38PM PDT, ID: 22047249

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Apple Programming, Objective-C Programming Language, Cocoa Programming Language
Tags: objective c
Sign Up Now!
Solution Provided By: smithdale87
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628