Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

File Locking on solaris with C++ fstream

807575Mar 25 2002 — edited Mar 28 2002
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2002
Added on Mar 25 2002
3 comments
277 views