lkml.org 
[lkml]   [2000]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: CD_Rom problems (fwd)

Sorry for the error in code... What I posted is not what I have written at
home it is the bitwise AND not logical AND.

Dave
On Wed, 12 Jul 2000, Richard B. Johnson wrote:

> 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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.051 / U:1.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site