Can I use POSIX file operations on android? -


i have part of code injecting touch event on android. there error:(54, 5) error: use of undeclared identifier 'write', i'm using ndk r15 , android_api 21.i want know possible use posix file operations on android?

#include <stdio.h> #include <string.h> #include <fcntl.h> #include <linux/uinput.h>  /* globals */ static int uinp_fd = -1; struct uinput_user_dev uinp; // uinput device structure struct input_event event; // input device structure /* setup uinput device */ int setup_uinput_device() {     // temporary variable     int i=0;  // open input device uinp_fd = open("/dev/uinput", o_wronly | o_ndelay); if (uinp_fd == 0) {     printf("unable open /dev/uinput/n");     return -1; }  memset(&uinp,0,sizeof(uinp)); // intialize uinput device null strncpy(uinp.name, "polyvision touch screen", uinput_max_name_size); uinp.id.version = 4; uinp.id.bustype = bus_usb;  // setup uinput device ioctl(uinp_fd, ui_set_evbit, ev_key); ioctl(uinp_fd, ui_set_evbit, ev_rel); ioctl(uinp_fd, ui_set_relbit, rel_x); ioctl(uinp_fd, ui_set_relbit, rel_y); (i=0; < 256; i++) {     ioctl(uinp_fd, ui_set_keybit, i); }  ioctl(uinp_fd, ui_set_keybit, btn_mouse); ioctl(uinp_fd, ui_set_keybit, btn_touch); ioctl(uinp_fd, ui_set_keybit, btn_mouse); ioctl(uinp_fd, ui_set_keybit, btn_left); ioctl(uinp_fd, ui_set_keybit, btn_middle); ioctl(uinp_fd, ui_set_keybit, btn_right); ioctl(uinp_fd, ui_set_keybit, btn_forward); ioctl(uinp_fd, ui_set_keybit, btn_back);  /* create input device input sub-system */ write(uinp_fd, &uinp, sizeof(uinp)); if (ioctl(uinp_fd, ui_dev_create)) {     printf("unable create uinput device.");     return -1; } return 1; 

}


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -