title: Retrieve device information in Linux from device file descriptor using c++
body: <p>How i can get device info including the device name from the device file descriptor?</p>
  
  <p>For example, in SKYPE i can see that device "/dev/snd/pcmC2D0c" has name: "USB 2.0 Camera. USB Audio Default Audio Device (default:CARD=Camera)"</p>
  
  <p>How i can get such device name using c++?</p>
  
  <pre><code>int file = open("/dev/snd/pcmC2D0c", O_RDWR | O_NONBLOCK, 0);
  if (-1 == file) // check is error occurred during opening?
  {
      perror("open");
      return -1;
  }
  if (-1 == ioctl(file, /* appropriate ioctl value to get the device info? */, /* appropriate structure to fill with device info? */))
  {
      perror("ioctl");
      return -1;
  }
  </code></pre>