how to read text from particular position in a textfile using iphone?
<p>i am new to iphone please help to me ,i want to read text from textfile using iphone now am able to read text from txtfile ,but my problem is(in txtfile saved some data like "welcome to webapps" in these text i want read only webapp string)
  By using this code am read all data from txtfile.please give any idea to read specified text only.</p>

<pre><code>-(NSString *)readFile:(NSString *)fileName {
    NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"txt"];  
    NSData *myData = [NSData dataWithContentsOfFile:filePath];  
    NSString *str,*docStr;

    if (myData) {  
        str = [[NSString alloc] initWithData:myData encoding:NSASCIIStringEncoding];

        } 
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    // the path to write file
    NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
    NSError *error = nil;
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:appFile];
    if(fileExists)
    {
        NSLog(@"file exist in document");
        NSData *myData1 = [NSData dataWithContentsOfFile:appFile];
        if (myData1) {  
            docStr = [[NSString alloc] initWithData:myData1 encoding:NSASCIIStringEncoding];

        } 
    }
    else {
        NSLog(@"file does not exist");

        BOOL success = [str writeToFile:appFile  atomically:YES encoding:NSUTF8StringEncoding error:&amp;error];
        if (!success) {
            NSLog(@"Error: %@", [error userInfo]);
        }
        else {
            NSLog(@"File write is successful");

        }
        NSData *myData1 = [NSData dataWithContentsOfFile:appFile];
        if (myData1) {  
            docStr = [[NSString alloc] initWithData:myData1 encoding:NSASCIIStringEncoding];

        } 
    }


    return docStr;
}
</code></pre>
