使用C ++访问iOS上的Documents文件夹 [英] Using C++ to access Documents folder on iOS

查看:143
本文介绍了使用C ++访问iOS上的Documents文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法在iOS上使用C ++获取对Documents文件夹的引用(即没有在Objective-C中使用任何代码;这是因为它是一个仅在C ++中实现的框架,可以添加作为iOS项目中的库。)

I'm wondering if there is a way to get a reference to the Documents folder on iOS using just C++ (i.e. WITHOUT using ANY code in Objective-C; this because it is a framework implemented only in C++ that can be add as a library in a iOS project).

如果可能的话,请在答案中提供代码。

Please, if it is possible, provide code in your answer.

推荐答案

使用下面的代码,我可以访问我的应用程序中的缓存文件夹。我认为,/ Library / Documents中的文档文件夹,或者其他一些文件夹。

With code below I able to access cache folder in my app. I think, documents folder in "/Library/Documents", or somewere else.

char *home = getenv("HOME");
char *subdir = "/Library/Caches/subdir";

home + subdir =完整路径

接下来,使用完整路径,您可以在C ++中执行通常的读/写操作

Next, with full path, you can do usual things to read/write in C++

这篇关于使用C ++访问iOS上的Documents文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆