Int_64 - 64 bit question

A

Alex

Hi,

I am a little confused as to how numbers are represented as 64 bit
integers.

I have a file that is 2GB in size.

I call __stati64 and from the st_size attribute, I see that the size
is returned as:

High - 0
Low - 2147483648

I know that high and low are unsigned and can be a maximum of 2**32
(ie. 4,294,967,296 bytes 4Gb)

So my question is, how is a 5Gb file represented in st_size??

Would it be:
High - 1
Low - 1073741824

My hardrive on my laptop is not big enough to test this and I cannot
find an answer on the web.
 
V

Victor Bazarov

Alex said:
I am a little confused as to how numbers are represented as 64 bit
integers.

What do you think is the difference between those and 32-bit ones or
16-bit ones? None, AFA C++ is concerned.
I have a file that is 2GB in size.

I call __stati64 and from the st_size attribute, I see that the size
is returned as:

High - 0
Low - 2147483648

What's __stati64? It's not a standard function. What does it return?
What's "High" and "Low"? Some 32-bit parts of a struct?
I know that high and low are unsigned and can be a maximum of 2**32
(ie. 4,294,967,296 bytes 4Gb)

If they are 32-bit unsigned integers, then the maximum is (2**32 - 1),
actually. That's 4,294,967,295.
So my question is, how is a 5Gb file represented in st_size??

Would it be:
High - 1
Low - 1073741824

_Assuming_ that 'High' and 'Low' are of type "unsigned long", then, yes,
_probably_.
My hardrive on my laptop is not big enough to test this and I cannot
find an answer on the web.

Try the FM for your compiler. You know, the second part of RTFM...

V
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,181
Messages
2,570,970
Members
47,537
Latest member
BellCorone

Latest Threads

Top