views:

458

answers:

1

Hello,

I want to read the string after delimiter from a text file in Objective-C.i'm stil struggling to get it :(.... This is wat i ve done til nw, but when i print the contents of databuffer in line 7 in code below, the data read is returning encapsulated in an NSData object.How to convert it into Readable format?

NSData *databuffer;

file = [NSFileHandle fileHandleForReadingAtPath: @"/tmp/myfile.txt"];

if (file == nil)
        NSLog(@"Failed to open file");

[file seekToFileOffset: 10];

databuffer = [file readDataOfLength: 6];

NSLog(@"Contents of buffer = %s", databuffer);

[file closeFile];
A: 
NSString* aStr = [[NSString alloc] initWithData:databuffer encoding:NSASCIIStringEncoding];
KevinDTimm
hey....Thank You
suse