Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/154.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 重定向cout时获取C2660参数错误(卡在Visual Studio 6中)_C++_Visual Studio - Fatal编程技术网

C++ 重定向cout时获取C2660参数错误(卡在Visual Studio 6中)

C++ 重定向cout时获取C2660参数错误(卡在Visual Studio 6中),c++,visual-studio,C++,Visual Studio,我正在尝试将两种方法移植到一个完全不同的硬件环境中的管道中,我没有太多的灵活性。我被迫使用VisualStudio6和cygwin shell 为了在设置时帮助调试,我想将打印到cout的“dump()”方法的输出重定向到一个文件。目前我无法覆盖或扩展dump方法,因此我正在尝试旧的技巧 #include<iostream> #include<fstream> std::ofstream out("out.txt"); std::cout.rdbuf(out.rdbuf

我正在尝试将两种方法移植到一个完全不同的硬件环境中的管道中,我没有太多的灵活性。我被迫使用VisualStudio6和cygwin shell

为了在设置时帮助调试,我想将打印到cout的“dump()”方法的输出重定向到一个文件。目前我无法覆盖或扩展dump方法,因此我正在尝试旧的技巧

#include<iostream>
#include<fstream>

std::ofstream out("out.txt");
std::cout.rdbuf(out.rdbuf()); 

我猜1998时代的C++可能不允许这种超越。这是正确的吗?有人能推荐一个可行的选项吗?

突出显示
rdbuf
,按F1,阅读文档。您还可以在标题中查看声明的内容。“MSDN集合不存在”。光标悬停会给我带来好运。它只显示了一个空方法,但我不能确定这是否意味着没有其他的(即它没有过载)。大多数所谓的C++编译器都不是完全标准的一致,但是MSVC 6太旧,太坏了,它不应该被称为C++编译器。升级同样,认识到我们对你的问题的答案可能不适用于VC6,因为它所接受的是太远离标准C++。
error C2660: 'rdbuf' : function does not take 1 parameters