how to capture output in vector form instead of printing it in C++

I have a function within a large project of the form given below (func is called 5 times within the call hierarchy in some Abc class) :

void Test::func(std::string c)
{
cout<<c;
}

The function func is called by some functions in a large hierarchy. But all that the function func does is printing a string. Now instead of printing the string I want to store its output somewhere(in vector form) so that I may use it later in the program at the point where the hierarchy of func begins. I am completely clueless as to how should I capture this output instead of printing it. CAN SOMEONE PLEASE HELP.

I want to define my own data structure whereby I can store it...but I am not getting how??
Last edited on
Well, include the file vector and declare a simple vector of strings:
std::vector<std::string> myStrings;

You can add items with the .push_back member function of the vector type.
Topic archived. No new replies allowed.