0

我正在尝试将几种方法移植到完全不同的硬件环境中的管道中,在这种环境中我没有很大的灵活性。我被迫使用 Visual Studio 6 和 cygwin shell。

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

#include<iostream>
#include<fstream>

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

在我的常规 Eclipse 环境中运行得很好。但在这里我得到

error C2660: 'rdbuf' : function does not take 1 parameters

我猜 1998 年的 C++ 可能不允许这种覆盖?这个对吗?任何人都可以提出一个可行的选择吗?

4

0 回答 0