文件夹中的临时文件创建在Android中,为什么/数据/本地/ tmp目录不为我工作? [英] Folder for temporary files creation in android, Why does /data/local/tmp doesn't work for me?
问题描述
我试图创建/数据/本地/ 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屋!