1SDL_CDOpen(3)                  SDL API Reference                 SDL_CDOpen(3)
2
3
4

NAME

6       SDL_CDOpen - Opens a CD-ROM drive for access.
7

SYNOPSIS

9       #include "SDL.h"
10
11       SDL_CD *SDL_CDOpen(int drive);
12

DESCRIPTION

14       Opens  a CD-ROM drive for access. It returns a SDL_CD structure on suc‐
15       cess, or NULL if the drive was invalid or busy. This newly  opened  CD-
16       ROM  becomes  the  default CD used when other CD functions are passed a
17       NULL CD-ROM handle.
18
19       Drives are numbered starting with 0. Drive 0 is the system default  CD-
20       ROM.
21

EXAMPLES

23       SDL_CD *cdrom;
24       int cur_track;
25       int min, sec, frame;
26       SDL_Init(SDL_INIT_CDROM);
27       atexit(SDL_Quit);
28
29       /* Check for CD drives */
30       if(!SDL_CDNumDrives()){
31         /* None found */
32         fprintf(stderr, "No CDROM devices available
33       ");
34         exit(-1);
35       }
36
37       /* Open the default drive */
38       cdrom=SDL_CDOpen(0);
39
40       /* Did if open? Check if cdrom is NULL */
41       if(!cdrom){
42         fprintf(stderr, "Couldn't open drive: %s
43       ", SDL_GetError());
44         exit(-1);
45       }
46
47       /* Print Volume info */
48       printf("Name: %s
49       ", SDL_CDName(0));
50       printf("Tracks: %d
51       ", cdrom->numtracks);
52       for(cur_track=0;cur_track < cdrom->numtracks; cur_track++){
53         FRAMES_TO_MSF(cdrom->track[cur_track].length, &min, &sec, &frame);
54         printf("     Track %d: Length %d:%d
55       ", cur_track, min, sec);
56       }
57
58       SDL_CDClose(cdrom);
59

SEE ALSO

61       SDL_CD, SDL_CDtrack, SDL_CDClose
62
63
64
65SDL                         Tue 11 Sep 2001, 22:58               SDL_CDOpen(3)
Impressum