NSString *contentPath = [[NSBundle mainBundle] pathForResource:@"test2" ofType:@"rtf"];
NSData *databuffer;
NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:contentPath];
if (file == nil)
NSLog(@"Failed to open file");
databuffer = [file readDataToEndOfFile];
[file closeFile];
NSString *contentText =[[NSString alloc] initWithData:databuffer encoding:NSUTF8StringEncoding];
debugLog(@"%@",contentText);
[textView setText:contentText];
[contentText release];
//[textView setText:[bookObj commentary]];
[self.view addSubview:textView];
Output:
i\ansicpg1252\cocoartf1038\cocoasubrtf320
{\fonttbl\f0\froman\fcharset0 Times-Roman;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\ql\qnatural\f0\fs24 \cf0 A stream is a fundamental abstraction in programming: a sequence of bits transmitted serially from one point to another point. Cocoa provides three classes to represent streams and facilitate their use in your programs: NSStream, NSInputStream, and NSOutputStream. With the instances of these classes you can read data from, and write data to, files and application memory. You can also use these objects in socket-based
How to filter those bold data..???