title: creating a binary (.bin) file and read values from file in iphone
body: <p>Hi i am trying to save text values as binary file and read from that file. i am using following code, i got the binary file in documents directory but when reading data from file only got some numbers please kindly help its urgent.
  For writing</p>
  
  <pre><code>NSString *documentsDirectoryPath = [self performSelector:@selector(tempDirectoryPath:) withObject:fileName_];
  NSLog(@"%@",documentsDirectoryPath);
  
  if ([[NSFileManager defaultManager] isWritableFileAtPath:documentsDirectoryPath]) {
      NSLog(@"content =%@",data_);
      [data_ writeToFile:documentsDirectoryPath atomically:YES];
      return YES;
  }
  </code></pre>
  
  <p>For reading i use the following code,</p>
  
  <pre><code>  NSString *documentsDirectoryPath = [self performSelector:@selector(tempDirectoryPath:) withObject:fileName_];
  
  if ([[NSFileManager defaultManager] isReadableFileAtPath:documentsDirectoryPath]) {
      NSMutableData *data_ = [NSMutableData dataWithContentsOfFile:documentsDirectoryPath];
  
      return data_;
  }
  </code></pre>
  
  <p>I got only numbers from the data_ .</p>
  
  <p>How to read the .bin file correctly.?</p>
  
  <p>I got the .bin file when extract get .bin.cpgz file.I can't open the file what is the reason ?Is anything wrong in code?
  I am pass  string in this way: </p>
  
  <pre><code>[self writeData:@"test string is here" toFile:@"mf.bin"]; 
  </code></pre>
  
  <p>Thanks. </p>