问题描述
我正在尝试从android studio c ++项目(HuaweiArEngine演示sdk演示)创建file.txt。我尝试了其他方法,但不幸的是我每次都失败了。
尝试了一个示例代码:
fstream file; //object of fstream class **I also tried ofstream**
//opening file "sample.txt" in out(write) mode
file.open("sample.txt",ios::out); // **I also tried differents path**
if(!file)
{
__android_log_print(ANDROID_LOG_ERROR,APPNAME,"Error in creating file!!!");
}
__android_log_print(ANDROID_LOG_ERROR,"File created successfully.");
//write text into file
file<<"ABCD.";
//closing the file
file.close();
我还添加了外部存储权限,但手机中没有SD卡。
首先,我不知道在哪里可以找到文件(我认为它是在包中的原因,这就是为什么我无法访问它)。 其次,我很想直接在计算机桌面上创建文件,可以吗?
感谢您的帮助, 约安
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)