How to find out length of a physical drive

G

galapogos

Hi,
I'm writing an applications that reads from a HDD 1 sector at a time.
I set the file pointer to the beginning of the physical drive using
SetFilePointerEx(), and then increment liDistanceToMove by 512 bytes
after each access. However, I want to know what is the length of the
physical drive so I don't overshoot it. How do I do this?
GetFileSizeEx seems to work on a folder level but my drive is
unpartitioned/unformatted so I need something that works on the
physical level.

TIA.
 
I

Ian Collins

galapogos said:
Hi,
I'm writing an applications that reads from a HDD 1 sector at a time.
I set the file pointer to the beginning of the physical drive using
SetFilePointerEx(), and then increment liDistanceToMove by 512 bytes
after each access. However, I want to know what is the length of the
physical drive so I don't overshoot it. How do I do this?
GetFileSizeEx seems to work on a folder level but my drive is
unpartitioned/unformatted so I need something that works on the
physical level.
Looks like you want a platform specific group.
 
P

Peter Nilsson

galapogos said:
Hi,
I'm writing an applications that reads from a HDD 1 sector
at a time. I set the file pointer to the beginning of the
physical drive using SetFilePointerEx(),

This isn't a standard C library function.
and then increment liDistanceToMove by 512 bytes
after each access. However, I want to know what is the
length of the physical drive so I don't overshoot it.

The C language standard can't answer that question. As such
your question is basically off topic. You should consult a
group specialising in either the interface you are using,
or the architecture you are working on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top