sh_none不是'std :: basic_filebuf< _Elem,_Traits>'的成员 [英] sh_none is not a member of 'std::basic_filebuf<_Elem,_Traits>'
问题描述
我尝试使用Microsoft特定的 filebuf: :sh_none 变量以在独占模式(另一个Microsoft特定功能)中打开 fstream
。我得到了上面的错误。我正在导入< fstream>
。如何解决此错误?
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 :我发现此线程,其中建议我尝试_SH_DENYNO。代码编译,我现在测试它。这对我没有任何意义,因为这没有记录在函数中。
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.
推荐答案
什么版本的Visual C ++
What version of Visual C++ are you using?
链接的Visual C ++ 6文档是iostreams的预标准版本,来自 #include< fstream.h> ;
。它不再可用,甚至在Visual C ++ 6.0中只有向后兼容性。
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.
此外, _SH_DENYNO
独占模式的相反。您希望 _SH_DENYRW
获得与 sh_none
相同的行为。以下是新文档: http://msdn.microsoft.com/en-us /library/44cs32f9.aspx ,最终导致您访问 http: //msdn.microsoft.com/en-us/library/8f30b0db.aspx 了解第三个参数的详细信息。
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.
这篇关于sh_none不是'std :: basic_filebuf< _Elem,_Traits>'的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!