lets say we have a function which prints text to the console and in which we do not have control over the source but we are able to call it. For example
void foo() {
std::cout<<"hello world"<<std::endl;
print_to_console(); // this could be printed from anything
}
is it possible to redirect the output of the above function to a string without changing the function itself?
I'm not looking for a way to do this via terminal
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…