Open File Fail(-1) With Different Flag Settings
I have a question about using open() with different flags in Native android. Because i want to open a file and ignore the cache& buffer, in oder to access the hardware(SD card)
Solution 1:
If the flag setting is O_CREAT | O_RDWR | O_NDELAY, S_IRUSR | S_IWUSR| O_DIRECT | O_SYNC . I can got a positive file descriptor(fd).
That is not quite correct usage of the form
intopen(constchar *pathname, int flags, mode_t mode);
But if I change the setting to O_CREAT | O_RDWR | S_IRUSR | S_IWUSR| O_DIRECT | O_SYNC the result is fail(-1).
What you call "setting" is an invalid mixture of flags and mode symbols. Also, since O_CREAT has been specified in flags, the mode argument must be supplied and it is not. Try separating the modes from the flags:
open(pathname, O_CREAT | O_RDWR | O_DIRECT | O_SYNC, S_IRUSR | S_IWUSR);
Post a Comment for "Open File Fail(-1) With Different Flag Settings"