Doubt in CDROM Ejecting Program
Niamathullah sharief
newbiesha at gmail.com
Sat Nov 26 12:03:54 EST 2011
I am having code for ejecting CDROM in my Linux system. This is code
> *#include <sys/types.h>*
> *#include <sys/ioctl.h>*
> *#include <fcntl.h>*
> *#include <linux/cdrom.h>*
> *#include <stdio.h>*
> *#include <stdlib.h>*
> *int main( int argc, char **argv )*
> *{*
> * int cdrom;*
> * int i;*
>
> * /* open device */*
> * if ((cdrom = open("/dev/cdrom",O_RDONLY | O_NONBLOCK)) < 0) {*
> * perror("open");*
> * exit(1);*
> * }*
>
> * /* eject */*
> * if(ioctl(cdrom, CDROMEJECT) < 0) {*
> * printf("Could not eject cdrom tray\n");*
> * }*
>
> * /* close device */*
> * close(cdrom);*
> * return 0;*
> *}*
> * *
>
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..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111126/206c2243/attachment.html
More information about the Kernelnewbies
mailing list