Bug#346004: iostream can't do files > 2GB
Package: libstdc++5-3.3
Version: 3.3.5-13
When I run this program:
big.cc:
-----------------
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream test("/scratch/bigfile.txt");
for (long i = 0; i < 1500000000; i++) {
test << i;
}
test.close();
return 0;
}
--------------------
$ ./big
Filesize limit exceeded
$ ls -l
total 2099204
-rw-r--r-- 1 oetiker oep 2147483647 Jan 4 20:58 bigfile.txt
it ends after writing two GB ...
The bug is fixed in the gcc-3.4 distro ... details here:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8610
This is on debian sarge.
cheers
tobi
--
______ __ _
/_ __/_ / / (_) Oetiker @ ISG.EE, ETL F24.2, ETH, CH-8092 Zurich
/ // _ \/ _ \/ / System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/ http://people.ee.ethz.ch/oetiker +41(0)44-632-5286
Reply to: