File operations

May 2, 2012 at 11:19pm
I've heard that some file operations break past 2 GB. Why is this, and is there any way to avoid it? Does this apply to ifstream and ofstream?
Last edited on May 2, 2012 at 11:19pm
May 3, 2012 at 12:30am
I don't know if any file operations break past 2 GB via the STL, but if that happens is because they are using a signed 32-bit integer to keep track of pointer positions or file sizes. A 32-bit signed integer can only reach a maximum value of 2GB - 1 byte (232 - 1 bytes).

To be honest, I don't think the STL would break. Did not check, but I think the STL uses size_t, which is unsigned AFAIK.
Last edited on May 3, 2012 at 12:30am
Topic archived. No new replies allowed.