Android NDK 中的文件操作 [英] File Operations in Android NDK
本文介绍了Android NDK 中的文件操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于性能原因,我主要使用 Android NDK 以 C 语言制作应用程序,但似乎 fopen 等文件操作在 Android 中无法正常工作.每当我尝试使用这些功能时,应用程序就会崩溃.
I am using the Android NDK to make an application primarily in C for performance reasons, but it appears that file operations such as fopen do not work correctly in Android. Whenever I try to use these functions, the application crashes.
如何使用 Android NDK 创建/写入文件?
How do I create/write to a file with the Android NDK?
推荐答案
其他答案是正确的.您可以使用 FILE
和 fopen
通过 NDK 打开文件,但不要忘记为其设置权限.
Other answers are correct. You can open a file through the NDK using FILE
and fopen
, but don't forget to place a permission for it.
在 Android 清单位置:
In the Android manifest place:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
这篇关于Android NDK 中的文件操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文