views:

52

answers:

3

Hi. 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?

+2  A: 

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.

Gregory Pakosz
what i mean by not opening is that i don't want user to see the contents of that file. User just drag that file on the text view, depending upon that i want to read contents of that file and do some manipulation of it's key values.
Shakti
That is quite helpful. But how get path of the file from text view?
Shakti
Gregory Pakosz
A: 

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)!

LuI
what i mean by not opening is that i don't want user to see the contents of that file. User just drag that file on the text view, depending upon that i want to read contents of that file and do some manipulation of it's key values.
Shakti
A: 

Can't do it from user space application.

AnandV