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.

Recommended Answers

All 2 Replies

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';
}

Ah yes. TOld you I was tired. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.