| re: from std::string to std::istream?
"Victor Bazarov" <v.Abazarov@comAcast.net> schrieb im Newsbeitrag
news:nPqdnXLo7cBwMqTfRVn-pQ@comcast.com...[color=blue]
> "Gernot Frisch" <Me@Privacy.net> wrote...[color=green]
>> Can I convert a std::string to a std::istream object?[/color]
>
> No. But you can create an std::istringstream object with it:
>
> std::string mystring("1 2 3");
> std::istringstream is(mystring);
> int one, two, three;
> is >> one >> two >> three;
>
> Of course, my effort is wasted if that's not what you wanted. Next
> time please be more verbose trying to explain what you need instead
> of asking about legality of a potential solution to your task.[/color]
Was it hard to understand?
Problem is: I have a function:
bool Read(ifstream&is)
{
}
and I changed it to:
bool Read(istram& is)
{
}
because I don't have a file to read from, but a string in memory. So,
your solution is exactly what I need, I guess.
Thanks a lot,
Gernot |