title: Detect when a USB device is connected in C
body: <p>I am new to C and am trying to write a program that syncs files on my computer to a USB device. It currently works my me cd'ing to the directory that the device mounts to and typing "myprog init" which creates a .myprog file. The idea then is that when a USB device is connected my program checks for the .myprog file, if it finds it then it syncs. Problem is that I can't figure out how to detect when a new USB device is connected.</p>
  
  <p>I am writing the program for Linux (I'm using Ubuntu 9.04) and using GCC.</p>
  
  <p>Thanks for any help :)</p>