title: read() in linux for event file
body: <p>I'm writing a program to track the mouse movements in linux. I read in another post that this can be done using read() system call to read the EventX file related to the mouse. I earlier was reading the serial port file and i used the read() to read it. But, then i sent in a character array to it and got back the serial characters. But, it doesnt seem to be in the mouse's case. The lines:</p>
  
  <pre><code>struct input_event ie;
  read(fd, &amp;ie, sizeof(struct input_event)
  </code></pre>
  
  <p>are used to read it. Here the ie is a struct. But i used to send in a char buffer in the serial port case. So, my question is: how do I know what struct/buffer to send. I got to know the answer for the above two code lines after googling, but if I want to read some other file,how would i know what struct/buffer to send. Please help me. </p>
  
  <p>Thank you.</p>