"Low Level" Data Writing

Hello,

It's pretty straight forward to simply save something on to a drive and add that file to the file system. But, you'd have no way of knowing exactly where on that drive that information was saved; the computer handles that for you.

But, what if you'd like to save something to a specific location on the drive?

How do you save to a specific sector, track, platter, part of the USB drive, etc.?

How do you perform a "low level" data write?

Do languages with direct memory management like C allow you to do these sorts of things?

Thanks.
 

TrainTrackHack

VIP Member
That depends on the OS. On Linux, since they are accessed through device files, you can open the device much like you would any other file (with some restrictions), including memory-mapping it (which is what filesystem code usually does).

I'm pretty sure this is fairly similar to how things are done in Windows, but I don't know the specifics.

EDIT: C standard has no express support for this, but both POSIX and Win32 APIs have mechanisms for this.
 
Last edited:
That depends on the OS. On Linux, since they are accessed through device files, you can open the device much like you would any other file (with some restrictions), including memory-mapping it (which is what filesystem code usually does).

I'm pretty sure this is fairly similar to how things are done in Windows, but I don't know the specifics.

EDIT: C standard has no express support for this, but both POSIX and Win32 APIs have mechanisms for this.

Thanks.

So, you're saying that you can do this sort of thing on a Linux machine?
 

TrainTrackHack

VIP Member
So, you're saying that you can do this sort of thing on a Linux machine?
You can definitely do this sort of thing on any reasonable OS, including Linux and Windows... I personally only know how to do this on Linux, though.
 
Top