[英]C++ read internal file Android NDK
There is a file located in /data/user/0/com.uniquestudio.android.iemoji/files/yibaiwan.txt
. 在
/data/user/0/com.uniquestudio.android.iemoji/files/yibaiwan.txt
有一个文件。
I want to read the file in JNI. 我想在JNI中读取文件。
ifstream in.open(in_file_name, ios::binary);
LOGD("%d", in.good() ? 1 : 0);
However in.good()
is always false
. 但是
in.good()
始终为false
。 What's wrong? 怎么了?
Can anyone help me? 谁能帮我? Thanks in advance.
提前致谢。
As you know, INTERNAL_STORAGE does not require permission. 如您所知,INTERNAL_STORAGE不需要许可。
The file is encrypted
file. 该文件是
encrypted
文件。 When I use above code to read normal file, everything works well. 当我使用上述代码读取普通文件时,一切正常。 Now I want to read the
encrypted
file then decrypt
it. 现在,我想读取
encrypted
文件然后decrypt
。
If anyone meets same issue, you maybe create file as root
role. 如果有人遇到相同的问题,则可以将文件创建为
root
角色。 If you edit file or create file under root
, you can not visit it anymore with normal user role. 如果您在
root
下编辑文件或创建文件,则无法再以普通用户身份访问该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.