checking to see if there is a cd?

Started by
4 comments, last by MaulingMonkey 18 years, 11 months ago
is there a function to see the name of the cd (in c++)? or is there another way for checking to see if you have the right cd in the cd-rom tray. thanks in advanced.
Advertisement
in what? I think it would depend on a number of things: your OS, your API, etc.
my siteGenius is 1% inspiration and 99% perspiration
Quote:Original post by silverphyre673
in what? I think it would depend on a number of things: your OS, your API, etc.


winxp, c++
The API is Win32, you will probably need to go searching though the platform sdk documentation for disc drive detection.

"I can't believe I'm defending logic to a turing machine." - Kent Woolworth [Other Space]

You can do the following checks to see if your CD-Rom is present:

- Check if the source drive is a CD-Rom Drive (using GetDriveType)

- Check if the volume label is OK (using GetVolumeInformation)

Hope that helps!
SDL has some CD-ROM related functions, notably related to your problem is SDL_CDStatus.

Quote:From the SDL documentation site: SDL_CDStatus
SDL_CDStatus
Name
SDL_CDStatus -- Returns the current status of the given drive.
Synopsis

#include "SDL.h"

CDstatus SDL_CDStatus(SDL_CD *cdrom);

/* Given a status, returns true if there's a disk in the drive */
#define CD_INDRIVE(status) ((int)status > 0)

[...]


Edit: Curse your evil, deceptice title!!! You want to know the name of the CD :-p. See SDL_CDName instead, then.

This topic is closed to new replies.

Advertisement