title: Append binary data to file
body: <p>in my iPhone application I need to append binary data to file:</p>
  
  <pre><code> NSError *error;
      NSFileManager *fileMgr = [NSFileManager defaultManager];
  
      NSData* data = [NSData dataWithBytes:buffer length:readBytes_];    
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0]; 
  
      NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"myFile"];
  
      NSFileHandle *myHandle = [NSFileHandle fileHandleForUpdatingAtPath:appFile];
      [myHandle seekToEndOfFile];
      [myHandle writeData: data];
      [myHandle closeFile];
     // [data writeToFile:appFile atomically:YES];
  
      // Show contents of Documents directory
      NSLog(@"Documents directory: %@",
            [fileMgr contentsOfDirectoryAtPath:documentsDirectory error:&amp;error]);
  </code></pre>
  
  <p>But in NSlog i don't see that there is my file. What is wrong?</p>