title: Dynamically find the mouse event id in /dev/input/event*
body: <p>I am using this code to read mouse input event in linux . </p>
  
  <pre><code>      #define MOUSEFILE "/dev/input/event13"
  
        if((fd = open(MOUSEFILE, O_RDONLY)) == -1) {
          perror("opening device");
          exit(EXIT_FAILURE);
        }
  
        while(read(fd, &amp;ie, sizeof(struct input_event)))
        {
  
        }
  </code></pre>
  
  <p>i manually use <code>cat /proc/bus/input/devices</code> in the terminal to find the event id of my connected mouse and it is different every-time i restart linux . Is there a way through which i could dynamically find the event id's of my connected mouse . </p>