I’m in the middle of fixing some rather old C++ code that used the old-style iostream library, and I came across the following non-compiling lines of code:
::ofstream ofile;
ofile.open("filename", ios::trunc, filebuf::openprot);
I get this error:
error C2039: 'openprot' : is not a member of 'std::basic_filebuf<_Elem,_Traits>'
So obviously it’s something that’s not around any more. The problem is, I can’t find any information on what openprot did as a parameter, and I therefore can’t replace it with something new, and I’m afraid to remove the parameter altogether.
Anyone with any historical C++ knowledge know what this thing did?
That parameter indicates/indicated the protection mode to open the file with. It shows up in this IBM Legacy Class Library Reference.
filebuf::openprotis/was the default argument to thefstreamclass family constructors andopenfunctions’protparameter, which indicates what protection mode the file should be opened/created with.For example, on your system it might be
0644, meaning that if the file is created, the owner will have read/write permissions, and everyone else will have read-only.Seeing as in your case the default argument was being passed in anyway, I would say that it’s safe to just remove.