I have a C++ Class with an std::ifstream
attribute. Every object of this class on creation takes a file path in the constructor, opens the file and using the std::ifstream
attribute and keeps it open during the lifetime of the object.
Somewhere else in the code, at a later point, I read a .ini
file using the boost::property_tree::read_ini
function.
Everything works as it should in the normal case. However, when I create more than 254 instances of above class having the std::ifstream
attribute, the totally unrelated code of reading the .ini
file fails and I get a std::runtime_error
with "cannot open file"
in the exception.what()
message.
This makes me wonder if I'm not allowed to keep more than a certain number of open std::ifstream
references.
Can anyone point out if this is the case or if I'm missing something?
Edit: - I'm using Windows x64 system