Infinite array size???

This is a discussion on Infinite array size??? within the C++ Programming forums, part of the General Programming Boards category; I have a text file, say it is text.txt, and I want to put it in an array, but I ...

Infinite array size???

I have a text file, say it is text.txt, and I want to put it in an array, but I don't want there to be a limit on the array's size. I want it to be able to handle insanely large number of characters in a string, and then overwrite the text with the output.

Re: Infinite array size???

Originally posted by Trauts I want it to be able to handle insanely large number of characters in a string, and then overwrite the text with the output.

Perhaps you should consider to only read portions of the file at one time, process it and then read some more.

If you really mean insanely large, remember that most implementations of fstream has a 2-4 GB file size limit (actually this has caused me some trouble) and you can never allocate more than 4 GB memory on a windows system (Win32, that is, win64 is not very common).

>But most (some?) implementations of the standard library uses a 32-bit integer to store the filesize

I currently use API specific functions to handle files. However, I am thinking about re-writing large parts of my code to make it non-OS specific & portable. I need to access large files (i.e. size > 4GB).

Are you saying that standard C++ methods do not allow for files > 4GB on a 32 bit OS?