In general, here is an example in the rad studio xe7 environment:

... ofstream *test[60]; String t; for(int i=1;i<=46;i++) { t="test"+String(i)+".log"; test[i]=new ofstream(t.c_str(),std::ios_base::trunc); (*test[i])<<"текст"<<i<<std::endl; } ofstream test1; test1.open("test47.log",std::ios_base::trunc); ofstream test2; test2.open("testNotWork.log",std::ios_base::trunc); Form1->Memo1->Text=strerror(test2.rdstate()); ... 

The first 47 threads are created and work well, the next ones are simply not created.

  • Even in ancient BCB6 you can open thousands of files in this way (checked on Win7Pro). Maybe you have no right to modify testNotWork.log ? - αλεχολυτ

2 answers 2

The system always has a limit on the number of open files.

Alas, in each system, the decision to increase their limitations.

  • 47 something does not pull on a system constraint, does it? Well, +3 standard - it turns out 50. Obviously not a programmer number, but a tidy one ... - Qwertiy

Found TFileStream , opens as you need.