文件夹中的临时文件创建在Android中,为什么/数据/本地/ tmp目录不为我工作? [英] Folder for temporary files creation in android, Why does /data/local/tmp doesn't work for me?

查看:2636
本文介绍了文件夹中的临时文件创建在Android中,为什么/数据/本地/ tmp目录不为我工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建/数据/本地/ tmp目录下的临时文件。路径是正确的,我已经添加权限WRITE_EXTERNAL_PERMISSION也。但我仍然得到本地code一个错误,说无法创建该文件。

I am trying to create a temporary file in /data/local/tmp directory. The path is correct and I have added permission WRITE_EXTERNAL_PERMISSION also. But still I get an error from native code saying that file can't be created.

在code是如下。

File *file = fopen("mytxt.txt", "/data/local/tmp/");

返回值文件始终包含空值,并不会创建任何文件。还有什么需要做的?

The return value file always contains a null value and no file is created. Is there anything else needed to do?

有,我可以使用用于此目的的机器人?

Is there any other temporary folder that i can use for this purpose in android?

感谢您的帮助,我可以得到的。

Thanks for any help that i can get.

推荐答案

传递给fopen的第二个参数()不正确。该参数应该是一个开放模式,而不是一个目录路径。见FOPEN手册页。

The second parameter passed to fopen() is incorrect. That parameter should be an opening mode, not a directory path. See the man page of fopen.

这篇关于文件夹中的临时文件创建在Android中,为什么/数据/本地/ tmp目录不为我工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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