2 GB Filesize Linux C++



  • Hi @ all
    I've got a problem on Linux with C++:
    I need to write some simulationdata to a file.
    This is really much data and I always get the following
    error when exceeding a filesize of 2GB:
    "filesize limit exceeded"

    It's not a problem with Linux itself, because
    with Java I managed to write a 16.9 GB File without any problems.
    For some compatibility reason I cannot do the writing of the simulationdata
    without C++.

    What can I do to write files bigger than that with C++?
    There's really no way around, I need that much.

    I hope you can help me 😉



  • if you're using the glibc functions for writing to the file on a 32bit architecture then you might consider using the

    #define _FILE_OFFSET_BITS 64
    

    macro before including any standard headers. can't say if it affects the stream operations of libstc++ tho, haven't tested this myself yet 🙂



  • Thanks for the fast reaction 🙂
    That worked well.
    I chanded my code and the file is now bigger than 2GB
    without any errors.
    Thanks a lot, with this working
    I've got a lot of work to do now 😉


Anmelden zum Antworten