Shakti
Shakti

Reputation: 1959

How to read file contents

I have a text view on which i m droping a plist file. It's displaying the path of the file which i dropped there. Now i want to read the contents of that file without opening the file. How to do that? Can anybody help me?

Upvotes: 2

Views: 807

Answers (2)

Gregory Pakosz
Gregory Pakosz

Reputation: 70204

EDIT: Have a look at the NSDictionary and NSMutableDictionary classes and the Property List Programming Guide.

NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];

Then you manipulate the dictionary and display (some of) its content in something like NSTableView.


"Now i want to read the contents of that file without opening the file"

I'm afraid it doesn't work that way. To read the content of a file, you have to open the file.

Upvotes: 2

LuI
LuI

Reputation: 49

Impossible! You have to open a file in order to read its content - either explicitely or implicitely (e.g. a module/command does it for you)!

Upvotes: 0

Related Questions