Ultimately, this is a limitation. Files are a great example of what is controlled by the operating system, and you will have to consult the documentation of your OS for a specific limit. On Linux, I believe that it is configured in the kernel. Additionally, there may be user and technological quotas.
I do not think 200 is too much to ask.
It is quite simple to try and see. Just write a program that will open more files until you get an error message.
Living example.
On Mac OS X 10.8, this program
#include <iostream> #include <fstream> #include <iomanip> #include <string> int main() { int i = 0; std::ofstream *f; do { f = new std::ofstream( std::to_string( i ++ ) ); } while ( * f << "hello" << std::flush ); -- i; // Don't count last iteration, which failed to open anything. std::cout << i << '\n'; }
Outputs 253 . So, if you're on a Mac, you're golden :).
source share