views:

221

answers:

2

Suggest a easy way to read the contents of a file in a string and display the contents using objective c language.

for example if there is an source.rtf file which contains

[name]lohith[/name]
[age]22[/age]

The program shld read the contents of this file into NSString object and display the contents in the following format:

name=lohith.
age=22.

I wld appreciate if anyone helped me out.

thanks.

A: 

C is your friend... Maybe you should take a look at the "string.h" header file, functions like strchr(), substr(), etc... No need for Objective-C for that kind of stuff...

Macmade
ur right macmade but its an assignment for me in obj c , so i gotta do it ..:-(
Then just use the methods in NSString: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html
Macmade
A: 

You would in this case generally want to use NSXMLParser (Reference) or NSXML (Reference)

Williham Totland