How to know BytesperSector?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

How to know BytesperSector?

Post by Psychophanta »

Does anybody know a quick and short way to know the bytes number per sector in a given data store device?
Soulfire
User
User
Posts: 23
Joined: Mon Mar 08, 2004 7:17 am

Post by Soulfire »

Isn't it like always 512?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Code: Select all

Drive$ = "C:\"

If GetDiskFreeSpace_(@Drive$, @SectorsperCluster.l, @BytesPerSector.l, @FreeClusters.l, @TotalClusters.l)

  Debug "BytesPerSector: "+Str(BytesPerSector)
  
Else

  Debug "error!"

EndIf
Note: The other values you get there are quite useless, because they are only
correct for drives smaller than 2GB.

The BytesPerSector value should be correct tough, even if the drive is too big. (acording to MS docs)

Timo
quidquid Latine dictum sit altum videtur
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Thanx Freak, it is what i needed :)
Post Reply