问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/4435091/sh-none-is-not-a-member-of-stdbasic-filebuf-elem-traits