sh_none is not a member of 'std::basic_filebuf<_Elem,_Traits>'
Asked Answered
S

1

1

I am trying to use the Microsoft Specific filebuf::sh_none variable to open an fstream in an exclusive mode (another Microsoft specific function). I am getting the above error. I am importing <fstream>. How can I fix this error?

UPDATE: I found this thread, where it was suggested that I try _SH_DENYNO instead. The code compiles, I am testing it now. This doesn't make any sense to me, as this isn't documented in the function.

Somniferous answered 14/12, 2010 at 1:23 Comment(0)
P
4

What version of Visual C++ are you using?

The Visual C++ 6 documentation you linked to is the pre-standard version of iostreams, from #include <fstream.h>. It's no longer available, and even in Visual C++ 6.0 was only there for backward compatibility.

Also, _SH_DENYNO is the opposite of exclusive mode. You want _SH_DENYRW to get the same behavior as sh_none. Here is the new documentation: http://msdn.microsoft.com/en-us/library/44cs32f9.aspx, which ends up directing you to http://msdn.microsoft.com/en-us/library/8f30b0db.aspx for details on the third parameter.

Perak answered 14/12, 2010 at 2:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.