This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]