File Locking on solaris with C++ fstream
807575Mar 25 2002 — edited Mar 28 2002Hi Guys,
I have a problem with file locking on Solaris 5.6 with fstream. All of the file locking methods I know act on a file descriptor (flock,lockf, fcntl). In this particular scenario I got to use any C++ streams.
I'm particularly concerned with fstream filebuf flags. In Window NT Iam using filebuf::sh_none falg to prevent another process or thread from accessing the same file till I explicitly close the file.
I read some where, we can use filebuf::openprot on solaris. But If I use this openprot my Compiler(Work Shop 5.0) giving compilation error
Error: openprot is not a member of std::basic_filebuf<char, std::char_traits<<char>>.
So, if somebody can provide me with some other options about this it would be very helpful.
Any help greatly appreciated
Thanks