title: Reading data from a file in Objective-C, how to?
body: <p>I'm trying to develop an iOS app , that allow the user to enter a word then press the button to get the definition of the word </p>
  
  <p>Actually I have a file which contains the words and their definitions such that </p>
  
  <pre><code>Apple , the definition 
  orange , the definition 
  </code></pre>
  
  <p>I wrote the code but I don't know why it's not working</p>
  
  <pre><code>#import "ViewController.h"
  
  NSString *readLineAsNSString(FILE *file);
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  @synthesize text;
  @synthesize lab;
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      // Do any additional setup after loading the view, typically from a nib.
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  - (IBAction)butt:(id)sender {
      FILE *file = fopen("1.txt", "r");
      NSString *a = text.text ;
      bool found =FALSE;
  
      while(!feof(file)|| !found )
      {
        NSString *line = readLineAsNSString(file);
          if ((a= [[line componentsSeparatedByString:@","] objectAtIndex:1])) {
              lab.text = [[line componentsSeparatedByString:@","] objectAtIndex:0];
          }
  
      fclose(file);
      }
  }
  
  @end
  </code></pre>
  
  <p>Can anyone help me to figure out what is wrong?</p>