Messages in this thread | | | Date | Wed, 12 Jul 2000 15:38:33 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | Re: CD_Rom problems (fwd) |
| |
On Wed, 12 Jul 2000, Dave wrote:
> Sorry about the seriousness comment... I wasn't trying to be snotty... You > guys really are the best in the world and deserve more credit than you all > get. > > I believe what I was writing is... > > int main () { > int file; > int stats; > file = open("/dev/hdd", O_RDONLY | O_NONBLOCK); > ioctl(file, CDROM_GET_CAPABILITY, & stats); > if (stats && CDC_SELECT_DISC) ^^ Will nearly always be true. > printf("Success!\n"); > else > printf("<DOH!> Something went wrong\n"); > return 0; > } >
The following works:
#include <stdio.h> #include <fcntl.h> #include <linux/cdrom.h>
int main () { int file; int stats; if((file = open("/dev/hdd", O_RDONLY | O_NONBLOCK)) < 0) { fprintf(stderr,"No such device\n"); return 0; } ioctl(file, CDROM_GET_CAPABILITY, & stats); if (stats & CDC_SELECT_DISC) printf("Success!\n"); else printf("<DOH!> Something went wrong\n"); return 0; }
Cheers, Dick Johnson
Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).
"Memory is like gasoline. You use it up when you are running. Of course you get it all back when you reboot..."; Actual explanation obtained from the Micro$oft help desk.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |