Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeModernizationNewsRAD StudioWebinarWindows

Upgrading C++Builder 12.2: Tip #3, Massive Files with iostreams

Screenshot Radically Different Why C++Builder 122 Matters webinarWelcome to a series of tips and tricks for taking advantage of the new Windows 64-bit Modern toolchain in C++Builder / RAD Studio 12.2! This builds on a webinar we did sharing a bunch of useful information on why and how the new C++Builder matters to you, where this was the very end (so go watch the start!)

Tip #3: Massive Files with iostreams

The old C++ Win64 STL had a maximum size of 4GB for files, even compiling as 64-bit. That meant if you used iostreams to handle a large file, you were out of luck. (Isn’t it good we replaced our STL?)

In 12.2, the new Win64 RTL keeps this by default (in 12.2) but can support massive files!

Just define: _FILE_OFFSET_BITS=64 in the compiler options.

Or, on the command line: -D_FILE_OFFSET_BITS=64

We might enable this by default in the next release.

Bonus tip: check out the RTL TEncoding class. This, with stream support, make it much easier to handle text encodings than C++’s default classes to, plus of course already support 64-bit file sizes, and you get great performance with TBufferedFileStream. But if you want to use the STL, with the new C++Builder you’re ok there too!

See What's New in 12.2 Athens See What's New in 12.2 Athens Dev Days of Summer 2-24

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

David is an Australian developer, currently living in far-north Europe. He is the senior product manager for C++ at Idera, looking after C++Builder and Visual Assist.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES