3

[ubuntu] ejecting cd rom by code

view full story
linux-howto

http://ubuntuforums.org – hi all, i use ubuntu 11.04 Code: int main (int argc, char* argv[]) { /* Open a file descriptor to the device specified on the command line. int fd = open (argv[1], O_RDONLY); /* Eject the CD-ROM. */ ioctl (fd, CDROMEJECT); /* Close the file descriptor. */ close (fd); return 0; } i compiled this program and when it run this code on terminal: Code: ./a.out /dev/sr0 it does not eject the cd rom.i tried Code: ./a.out /dev/cdrom and Code: ./a.out /dev/cdrw it does not work.program runs but cd rom not ejected.do you have any idea what is wrong? Regards. (Hardware)