Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading raw data from a CD 1

Status
Not open for further replies.

williamu

Programmer
Apr 8, 2002
494
0
0
GB
Hi all,

I'm needing to read raw data from an ISO 9660 (Audio) CD ROM in both Unix and Windows! I've got my structures all ready (I hope) but filling them is proving to be troublesome (especially in Windows).

Can

William
Software Engineer
ICQ No. 56047340
 
Hi all,

I'm needing to read raw data from an ISO 9660 (Audio) CD ROM in both Unix and Windows! I've got my structures all ready (I hope) but filling them is proving to be troublesome (especially in Windows).

Can anyone help me out?


William
Software Engineer
ICQ No. 56047340
 
What specifically is the problem? What do you mean you are having trouble "filling your structures"? Post some code so we can see what you're trying to do.
 
Hi,

My problem is simply one of stupidity. I don't know how to open the device so I can read the media starting at sector 0. So I can :

? * pHandle = 0 ;
pHandle = ?
fread (&ISOStruct, sizeof(ISO), 1, pHandle) ;

Ideally I'd like to use code that will work under *nix as well as windows.


William
Software Engineer
ICQ No. 56047340
 
This will be platform specific, so you'll need to duplicate some code to account for the Windows and Unix-specific parts. Here are some knowledgebase articles from MSDN that should help for Windows:

Windows 95 (probably 98 & ME as well):

Windows NT (probably 2000, too):

I think Unix will be a lot more straightforward. You can probably just open and read the "raw" device using the regular POSIX functions (open, read, close). So if your cd-rom is mounted on /dev/cd0, you'll want to access the raw device, which might be /dev/rcd0. The device names will differ across Unices.

You may want to abstract the platform-specific stuff into a class so that code that wants to work with the cd roms doesn't have to know which platform its running on.

class iso_9660_sector {
// components of a single sector
};

class iso_9660 {
public:
iso_9660 &open_device(std::string device_name);
iso_9660 &close_device();
iso_9660_sector read_sector();
// etc.
};

iso_9660 &iso_9660::eek:pen_device(std::string device_name)
{
#if defined WIN32
// Win9x code
#elif defined WINNT
// WinNT code
#else
// Unix code
#endif
}
 
Hi,

What can I say but "perfect". Here's a star.


William
Software Engineer
ICQ No. 56047340
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top