BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

32 bit File O and 64 Bit File IO

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Colin B Maharaj
Guest





PostPosted: Fri May 11, 2007 2:53 pm    Post subject: 32 bit File O and 64 Bit File IO Reply with quote



Hi all,
just wondering, I have this application that does a lot
of file processing and the size requirements of one
of my installations may pass the 2 gig limit soon!

I am using the BCB stock file routines
like FileOpen, FileCreate, FileRead, FileWrite.

I had realize some time back that there are
both 64 and 32 bit routines in the same name
now my questions:

1. Does the FileWrite routine writes pass 2 or 4 GIGs nowhere do I see
that FileWrite is 64 bit based?

2. Similarly does the FileRead routine work pass the 2 or 4 GIGs point?

.. It is clear that FileSeek is both 64 and 32 bit based. So
doe it mean that most of my recoding will be based on
using a 64 bit file pointer for seek operations and thats it!! (?)

I am using BCB6 on XP

BTW: Should I switch to Vista Ultimate (got it as a gift!)


Thanks
Colin B Maharaj
Programmer
I-CNS Limited
Trinidad WI.
Back to top
Bob Gonder
Guest





PostPosted: Fri May 11, 2007 7:12 pm    Post subject: Re: 32 bit File O and 64 Bit File IO Reply with quote



Colin B Maharaj wrote:

Quote:
1. Does the FileWrite routine writes pass 2 or 4 GIGs nowhere do I see
that FileWrite is 64 bit based?

Should not matter unless you are trying to write more than 4 GB in one
call. (Notice that there is _no_ position argument, which would be the
limiting file-size factor.) The limiting factor is the OS. You can use
files as large as the underlying OS allows.

Quote:
2. Similarly does the FileRead routine work pass the 2 or 4 GIGs point?

Again, there is no positioning argument, so the size of the file does
not matter. Only the size of your read matters.

Quote:
It is clear that FileSeek is both 64 and 32 bit based. So
doe it mean that most of my recoding will be based on
using a 64 bit file pointer for seek operations and thats it!! (?)

If it does use 64bit integers, then yes.
(The 32/64 overload is seen on the Delphi, but not C++ help)

Otherwise, you might look to the WinApi

CreateFile()
ReadFile()
WriteFile()
SetFilePointer() uses 2-32bit integers for a 64bit offset.
SetFilePointerEx() uses 1-64bit integer.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 11, 2007 9:59 pm    Post subject: Re: 32 bit File O and 64 Bit File IO Reply with quote



"Colin B Maharaj" <noreply (AT) myhost (DOT) com> wrote in message
news:46443D35.2050709 (AT) myhost (DOT) com...

Quote:
Does the FileWrite routine writes pass 2 or 4 GIGs

Yes.

Quote:
nowhere do I see that FileWrite is 64 bit based?

It doesn't need to be, because it doesn't deal with file offsets
directly, so it doesn't care whether the current offset is past 2GB or
not.

Quote:
Similarly does the FileRead routine work pass the 2 or 4 GIGs point?

Yes.

Quote:
It is clear that FileSeek is both 64 and 32 bit based. So
doe it mean that most of my recoding will be based on
using a 64 bit file pointer for seek operations and thats it!! (?)

File pointers have always been 64-bit at the OS level.
SetFilePointer() has supported 64-bit file sizes for many years now.
FileSeek(), however, did not utilize the higher 32 bits until BCB6.


Gambit
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri May 11, 2007 10:00 pm    Post subject: Re: 32 bit File O and 64 Bit File IO Reply with quote

"Bob Gonder" <notbg (AT) notmindspring (DOT) invalid> wrote in message
news:a1t8439ecms6dam3jiasc4nm3j4tbps17d (AT) 4ax (DOT) com...

Quote:
If it does use 64bit integers, then yes.
(The 32/64 overload is seen on the Delphi, but not C++ help)

The 64-bit overload of FileSeek() is in BCB6's help file.


Gambit
Back to top
Bob Gonder
Guest





PostPosted: Sat May 12, 2007 12:06 am    Post subject: Re: 32 bit File O and 64 Bit File IO Reply with quote

Remy Lebeau (TeamB) wrote:
Quote:
"Bob Gonder" wrote in message

(The 32/64 overload is seen on the Delphi, but not C++ help)

The 64-bit overload of FileSeek() is in BCB6's help file.

Ah yes, so it is.
Wonder why it's not in the BDS version?
Back to top
Colin B Maharaj
Guest





PostPosted: Sat May 12, 2007 3:42 pm    Post subject: Re: 32 bit File O and 64 Bit File IO Reply with quote

It was really simpler than
I thought. Now my application can read/write to a
160GB file now (at least)!

I did a lot of coding doing my own file io routines on an
application I wrote many years ago before I know a hint
about SQL (my/ms/oracle).

The reporting is based on flat files.
And folks still use it today.

Just have to move everything to a RDBMS now
or at least have this as an option for
the SQL savvy user.


Thanks for all the responses.

Colin B Maharaj
Full time developer
php/xhtml/c++/javascript/css/cshell
Trinidad, West Indies


[ I Liberated myself from the ]
[ Telecoms company I once worked ]

Remy Lebeau (TeamB) wrote:
Quote:
"Colin B Maharaj" <noreply (AT) myhost (DOT) com> wrote in message
news:46443D35.2050709 (AT) myhost (DOT) com...

Does the FileWrite routine writes pass 2 or 4 GIGs

Yes.

nowhere do I see that FileWrite is 64 bit based?

It doesn't need to be, because it doesn't deal with file offsets
directly, so it doesn't care whether the current offset is past 2GB or
not.

Similarly does the FileRead routine work pass the 2 or 4 GIGs point?

Yes.

It is clear that FileSeek is both 64 and 32 bit based. So
doe it mean that most of my recoding will be based on
using a 64 bit file pointer for seek operations and thats it!! (?)

File pointers have always been 64-bit at the OS level.
SetFilePointer() has supported 64-bit file sizes for many years now.
FileSeek(), however, did not utilize the higher 32 bits until BCB6.


Gambit

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.