0

It is late here, I am tired. I know this is probably out there somewhere, and that I am not showing effort by not looking for it, but I really am too tired, so tomorrow morning if this is answered (takes you like 2 seconds to answer it) I'll mark it as solved and thats an easy point to whoever last posted.

Anyhow, how can you use stringstream to only extract things from a certain point onwards?

So, if I have the person input


C4,

Have stringstream start extracting from 2 instead of from the start?

I can always use Find_First_Not_Of to determine where it is.

Thanks.

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jonathanasdf
1

A stringstream is still a stream. You can seek on it:

#include <iostream>
#include <sstream>

int main()
{
  std::stringstream sin ( "123456789" );
  int value;

  sin.seekg ( 2 );
  sin>> value;

  std::cout<< value <<'\n';
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.