title: Data exchange Objective-C vs. C++ file based
body: <p>For some reasons I evaluate the option to exchange data between my iOS-App and my C++-Lib (used by the iOS-App) by file.</p>
  
  <p>C++ (works fine on a local machine):</p>
  
  <pre><code>    void LibFacadeTest::testFileAccess()
      {
        this-&gt;log-&gt;info("start testFileAccess");
  
          char filename[] = "./test.txt";
          std::string result;
  
          LibFacade *e = new LibFacade();
  
          try
          {
              result = e-&gt;testFileAccess(filename);
          }
          catch(...)
          {
              this-&gt;log-&gt;error("error");
          }
          this-&gt;log-&gt;info("Result:" + result);
  
          delete(e);
    }
  </code></pre>
  
  <p>Recompiled for ARM and run on device I can see that the filename parameter is passed correctly (via log), but nothing is returned.</p>
  
  <p>Here is the Objective-C code:</p>
  
  <pre><code>LibFacade *tlb = new LibFacade();
  char *testName = "blub.txt";
  
  std::string str = tlb-&gt;testFileAccess(testName);
  
  // Check, if file exists
  NSFileManager *filemgr;
  
  filemgr = [NSFileManager defaultManager];
  
  if ([filemgr fileExistsAtPath: @"blub.txt" ] == YES)
      NSLog (@"File exists");
  else
      NSLog (@"File not found");
  
  NSError *error = nil;
  NSString *myString = [NSString stringWithContentsOfFile:@"blub.txt" encoding:NSUTF8StringEncoding error:&amp;error];
  
  UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:myString                                               
  delegate:nil                                                      cancelButtonTitle:nil                                                destructiveButtonTitle:myString                                                      otherButtonTitles:nil];
      [actionSheet showInView:self.view];
  </code></pre>
  
  <p>A bit quick and dirty, but what I can see is that there no file has been created on device although the lib could be used.</p>
  
  <p>My question:
  Are there any restrictions to access a device file system from an included C++ lib? Do I have to use any special directories for file exchange?</p>