title: how to control Linux mouse cursor movement in C
body: <p>i'm trying to make an app for the remote control of mouse on linux server by android application. As a beginner, i've got lot of probs..before writing the linux Server with C, I tried to check if i can control and move the mouse on Linux according to the code :</p>
  
  <pre><code>#include &lt;unistd.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;sys/time.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;linux/input.h&gt;
  
  int main(){
  struct input_event event, event_end;
  int i=0;
  int fd = -1;
  
  fd = open("/dev/input/event4", O_RDWR | O_NONBLOCK);
  if(fd&lt;0){
  perror("error");
  }
  
  memset(&amp;event, 0, sizeof(event));
  memset(&amp;event, 0, sizeof(event_end));
  gettimeofday(&amp;event.time, NULL);
  event.type = EV_REL;
  event.code = REL_X;
  event.value = 100;
  gettimeofday(&amp;event_end.time, NULL);
  event_end.type = EV_SYN;
  event_end.code = SYN_REPORT;
  event_end.value = 0;
  for( i=0; i&lt;5; i++){
  
  write(fd, &amp;event, sizeof(event));// Move the mouse
  write(fd, &amp;event_end, sizeof(event_end));// Show move
  
  sleep(1);
  }
  close(fd);
  return 0;
  }
  </code></pre>
  
  <p>after build compile execute.. nothing happens
  cursor never moves..will it be somekind of VirtualBox setting issue? </p>
  
  <p>sudo cat /dev/input/event4 shows weird string of symbols when i physically move the mouse.
  That means to be able to get contol of mouse cursor movement by event4 isn't it? 
  i wonder why the cursor won't move... anyone can help?</p>
  
  <p>And further, I would be glad if anyone suggests Library and Functions to control mouse</p>
  
  <p>thx a lot</p>