Deprecated: Array and string offset access syntax with curly braces is deprecated in /homepages/21/d38531796/htdocs/jose/smfforum/Sources/Subs.php on line 3825
Print Page - SDL: Enumerating CDROM Drives

Theo's Forum

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => OpenGL (Open Graphics Library) => Source Code => Graphics and Multimedia => SDL (Simple Directmedia Layer) => Topic started by: José Roca on July 27, 2008, 10:21:28 PM

Title: SDL: Enumerating CDROM Drives
Post by: José Roca on July 27, 2008, 10:21:28 PM
 
The following example enumerates the CDROM drives installes in your computer.

Code: [Select]
#COMPILE EXE
#DIM ALL
#INCLUDE "SDL.INC"

FUNCTION PBMAIN () AS LONG

   ' Initialize SDL
   IF SDL_Init(%SDL_INIT_CDROM) < 0 THEN
      ? "Couldn't initialize SDL" & SDL_GetError
      #IF %DEF(%PB_CC32)
         WAITKEY$
      #ENDIF
      EXIT FUNCTION
   END IF

   ' Find out how many CD-ROM drives are connected to the system
   LOCAL nDrives AS LONG
   LOCAL i AS LONG

   nDrives = SDL_CDNumDrives
   FOR i = 0 TO nDrives - 1
      ? "Drive" & STR$(i) & " " & SDL_CDName(i)
   NEXT

   ' Shut down SDL
   SDL_Quit

   #IF %DEF(%PB_CC32)
      WAITKEY$
   #ENDIF

END FUNCTION