1

嗨,我发现自己无法写入 ios 上的文件。这是路径:

知道我做错了什么吗?应用程序支持 iTunes 文件共享设置为 YES。

/var/mobile/Applications/BB0464AB-2F13-4B23-81BF-FBA0D5A40D9A/MyApp.app/Documents/a.txt

        ofstream myfile;
        myfile.open ("/var/mobile/Applications/BB0464AB-2F13-4B23-81BF-FBA0D5A40D9A/MyApp.app/Documents/a.txt");
        myfile << "Writing this to a file.\n";
        myfile.close();


        string line;
        ifstream myfile2 ("/var/mobile/Applications/BB0464AB-2F13-4B23-81BF-FBA0D5A40D9A/MyApp.app/Documents/a.txt");
        if (myfile2.is_open())
        {
            while ( myfile2.good() )
            {
                getline (myfile2,line);
                cout << line << endl;
            }
            myfile2.close();
        } else std::cout << "Unable to open file";
4

0 回答 0