Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:41:18+00:00 2026-05-27T22:41:18+00:00

For some reasons I evaluate the option to exchange data between my iOS-App and

  • 0

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.

C++ (works fine on a local machine):

    void LibFacadeTest::testFileAccess()
    {
      this->log->info("start testFileAccess");

        char filename[] = "./test.txt";
        std::string result;

        LibFacade *e = new LibFacade();

        try
        {
            result = e->testFileAccess(filename);
        }
        catch(...)
        {
            this->log->error("error");
        }
        this->log->info("Result:" + result);

        delete(e);
  }

Recompiled for ARM and run on device I can see that the filename parameter is passed correctly (via log), but nothing is returned.

Here is the Objective-C code:

LibFacade *tlb = new LibFacade();
char *testName = "blub.txt";

std::string str = tlb->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:&error];

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:myString                                               
delegate:nil                                                      cancelButtonTitle:nil                                                destructiveButtonTitle:myString                                                      otherButtonTitles:nil];
    [actionSheet showInView:self.view];

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.

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:41:19+00:00Added an answer on May 27, 2026 at 10:41 pm

    Your application is “sandboxed”, meaning that it cannot access files outside of its temporary and document file space. "./test.txt" is outside the “sandbox area”, so iOS correctly does not let you access that file. In a nutshell, if you would like to transfer data using temporary files, you’d need something like this for a file name:

    NSString *tempDirectoryName =
        [NSTemporaryDirectory() stringByAppendingPathComponent:@"test.txt"];
    

    This document provides further reading on the subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The HttpModule works fine (hello is replaced with hello world) but for some reasons
For some reasons this part where I fetch JSON data from following url will
For some reasons, SSIS is not avalialble. I read about OPENROWSET, but I will
For some reasons, I would like to do an explicit quoting of a string
For some reasons, my will_paginate collection is stuck on page 2. I have the
What are some reasons why PHP would force errors to show, no matter what
What are some reasons why I wouldn't want to disable IIS logging completely for
I'd like to hear some reasons for using a ServerControl opposed to a UserControl.
I am developing a web application. For some reasons, I need to use external
I'm trying to use JQuery's autocomplete plug-in but for some reasons Internet Explorer is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.