android is a kind of linux,and it must support the posix.But,when it seems not support the syscall,open(). Here is the code for testing,and i compile it via NDK:
#include <unistd.h>
#include <stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
void main(){
int fd;
char pathname[128] = "/data/pwrite.txt";
fd = open(pathname, O_WRONLY);
if(fd==-1){
printf("open fail.\n");
}
perror("/data/pwrite.txt");
}
and the following is the prompt that comes from android:
kaiwii@ubuntu:~$ adb shell /data/pwrite/test1
open fail.
/data/pwrite.txt: No such file or directory