* File Stream Open Problem with g++ 3.3.3 and libstdc++.so.5
@ 2004-03-30 7:39 Subrata Basak
0 siblings, 0 replies; only message in thread
From: Subrata Basak @ 2004-03-30 7:39 UTC (permalink / raw)
To: gcc-help; +Cc: sin-ming, halim, subrata-basak
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 streams,
but when I run my program, it creates only 254 file streams,
after that assertion occurs!!!!
OUTPUT :
========
$ echo $SHELL
/usr/bin/sh
$
$ ulimit -n
50000
$
$ ./a.out
i : 253
errno : 24
Assertion failed: in[i], file main.cpp, line 28
Abort - core dumped
$
========
MY CODE :
==================================================
#include <sys/errno.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <string>
extern int errno;
const int MAX_STREAM = 1000;
using namespace std;
int main(int argc, char* argv[])
{
ofstream in[MAX_STREAM];
string file("boo");
for ( int i=0; i != MAX_STREAM; i++ )
{
in[i].open(file.c_str(), ios::out);
if ( errno > 0 ) {
cout << "i : " << i << endl;
cout << "errno : " << errno << endl;
} // end of "if ( errno > 0 ) {"
assert(in[i]);
}
return 0;
}
===================================================
But, if I compile the exactly same program with the
following compiler and run the executable under the
same environment as above, 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-03-30 1:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-30 7:39 File Stream Open Problem with g++ 3.3.3 and libstdc++.so.5 Subrata Basak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).