the eject command simple won't work if there is no disk in the drive
the call to get the file descriptor will fail you can get some info using int test = (ioctl(fdcdrom, CDROM_DRIVE_STATUS)); but it doesn't do any good unless you want to close it if it's open or something no matter how you implement it or in what language it won't open with no disk in it so you are covered Code:
#include <fcntl.h> |
Yes, actually that's a good idea. Actually, while that may be true for the eject ioctl call, it isn't true for the eject command. When I type "eject" at a shell and there's no CD in my drive, the tray pops out. I think the difference is that you haven't passed the O_NONBLOCK flag to the open command; the "eject" program does, as does my program. But your program is probably useful and is simpler than mine too.
|
All times are GMT -5. The time now is 04:17 PM. |