I am having code for ejecting CDROM in my Linux system. This is code <br><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><b>#include <sys/types.h></b><br>
<b>#include <sys/ioctl.h></b><br><b>#include <fcntl.h></b><br><b>#include <linux/cdrom.h></b><br><b>#include <stdio.h></b><br><b>#include <stdlib.h></b><br><b>int main( int argc, char **argv )</b><br>
<b>{</b><br><b> int cdrom;</b><br><b> int i;</b><br><br><b> /* open device */</b><br><b> if ((cdrom = open("/dev/cdrom",O_RDONLY | O_NONBLOCK)) < 0) {</b><br><b> perror("open");</b><br>
<b> exit(1);</b><br><b> }</b><br><br><b> /* eject */</b><br><b> if(ioctl(cdrom, CDROMEJECT) < 0) {</b><br><b> printf("Could not eject cdrom tray\n");</b><br><b> }</b><br>
<br><b> /* close device */</b><br><b> close(cdrom);</b><br><b> return 0;</b><br><b>}</b><br><b> </b><br></blockquote>CDROM
is ejecting fine. ie its opening. But i don't know how to make my CDROM
to close. Even if i run these program again its not closing. Can anyone
help me..