Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualultramailman

Posted 28 December 2012 - 10:56 PM

You can use sscanf from stdio. It's like scanf, except it's used on a char* instead of stdin.

 

sscanf("640x480x32", "%dx%dx%d", &num1, &num2, &num3);

 

You can also write your own function to parse it.

 

But I have a feeling that it is possible to parse it with just string stream and a few << operators.


#1ultramailman

Posted 28 December 2012 - 10:55 PM

You can use sscanf from stdio. It's like scanf, except it's used on a char* instead of stdin.

 

sscanf("640x480x32", "%dx%dx%d", mystring.c_str());

 

You can also write your own function to parse it.

 

But I have a feeling that it is possible to parse it with just string stream and a few << operators.


PARTNERS