This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
File Stream Open Problem with g++ 3.3.3 and libstdc++.so.5
- From: "Subrata Basak" <subrata-basak at mediaring dot com>
- To: "'Robert Schweikert'" <rjschwei at cox dot net>,"'gcc-libstdc++'" <libstdc++ at gcc dot gnu dot org>
- Cc: "'gcc-patch'" <gcc-patches at gcc dot gnu dot org>,<subrata-basak at mediaring dot com>,<sin-ming at mediaring dot com>,<halim at mediaring dot com>
- Date: Mon, 29 Mar 2004 16:50:16 +0800
- Subject: File Stream Open Problem with g++ 3.3.3 and libstdc++.so.5
Hi
I am facing one problem when I complie and run my code
with the following compiler and standard c++ library :
Compiler Used : g++ 3.3.3
Standard Library Used : libstdc++.so.5
Problem : I am supposed to create 1000 file stream,
but when I run my program, it creates only 254 file stream,
after that assertion occurs!!!!
My Code :
============================
#include <assert.h>
#include <string>
#include <fstream>
const int MAX_STREAM = 1000;
using namespace std;
int main(int argc, char* argv[])
{
ifstream in[MAX_STREAM];
string file("boo");
for ( int i=0; i != MAX_STREAM; i++ )
{
in[i].open(file.c_str());
cout << "i : " << i << endl;
assert(in[i]);
}
return 0;
}
============================
But, if I use the exactly same program with the following
compiler, it is running without any problem and 1000 file
streams are created smoothly without any assertion.
Compiler Used : g++ 2.95.3
Standard Library Used : libstdc++.so.2.10.0
Anybody can help me to overcome this problem with
g++ 3.3.3 compiler and libstdc++.so.5 library.
With Very Best Regards
Subrata Basak
MediaRing Ltd., Singapore