Hello.
I have a very newbie question about Streams. The situation is that i have a function (that i cannot modify it's definition/call):
Until now this function was called passing a istream that had been previously filled with the content of a file (with ifstream).
But now, i don't have a file to fill "in", i have a vector of strings like:
So, i was wondering how to fill the variable "in" with the content of this vector like if it was read by a file containing:
I have tried defining a "ostream" variable and also with a "ostringstr eam" variable, but it complains because the function F1 is waiting for a type "istream".
I know that it seems a dummy question, but i can say that i have been with this stupid thing for hours... :(
Thank you very much in advance,
I have a very newbie question about Streams. The situation is that i have a function (that i cannot modify it's definition/call):
Code:
public void F1(istream & in){ while( ...) { in >> value do stuff with value; } }
But now, i don't have a file to fill "in", i have a vector of strings like:
Code:
std:: vector <std::string> str_Vector; str_Vector.push_back("textA\n"); str_Vector.push_back("textB\n"); str_Vector.push_back("textC\n");
textA
textB
textC
textB
textC
I have tried defining a "ostream" variable and also with a "ostringstr eam" variable, but it complains because the function F1 is waiting for a type "istream".
I know that it seems a dummy question, but i can say that i have been with this stupid thing for hours... :(
Thank you very much in advance,
Comment