device access

device access

Is it possible to read the sectors from a floppy device (or any device)
starting at sector 0 with CVF? I've tried many OPEN variations with
no success.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Have you tried opening the drive with a format of 'binary'?

James

Hmm, I'm skeptical that that would work. If it did, it would require NT/2000/XP and administrator privilege and a filename of the form .PHYSICALDRIVEn, where "n" is a zero-based number for the drive. The killer here is that there is a restriction that the I/O buffer be sector-aligned, which the CVF run-time library doesn't do.

You'd be better off to call the Win32 CreateFile and ReadFile directly. See the documentation for CreateFile.

Steve

Retired 12/31/2016

Steve, I don't see how calling CreateFile and ReadFile would differ in this case. It seems like this was what that format was provided to do. If you do reads using a buffer equivalent to the sector size, then I would expect the underlying ReadFile to remain in alignment.

James

The run-time library is going to read into its own buffer, not your variable. The RTL's buffer isn't going to be "sector aligned" (which is device-dependent.)

It's easy enough to use CreateFile and ReadFile from CVF.

Steve

Retired 12/31/2016

Thanks you both for your suggestions, I'll get right on it and keep you posted.

Leave a Comment

Please sign in to add a comment. Not a member? Join today