I take it that the permissions on the file are in fact 0777
.
You added android.permission.READ_EXTERNAL_STORAGE
, but you try to open for writing
FILE* fp = fopen("/storage/sdcard0/input.txt","w+");
You can get the error by checking for errno
and get a message with strerror
.
You must either open the file for reading only "r"
or add permission for writing WRITE_EXTERNAL_STORAGE