fork download
  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main ()
  6. {
  7. char str[] = "123,234,210";
  8.  
  9. uint8_t r, g, b;
  10.  
  11. if ( sscanf( str, "%hhu,%hhu,%hhu", &r, &g, &b ) == 3 )
  12. {
  13. printf( "r = %hhu, g = %hhu, b = %hhu\n", r, g, b );
  14. }
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
r = 123, g = 234, b = 210