Potrzebuję taką funkcjonalność:
#include <stdio.h>
#include <iostream>
#include <string>
int main ()
{
char sentence []="{ 42, LE_CUP, 1 }";
char s[20];
int i;
int j;
sscanf (sentence,"{ %d, %s, %d }",&i,s,&j);
std::cout << i << std::endl;
std::cout << s << std::endl;
std::cout << j << std::endl;
return 0;
}
Ale mi to nie działą bo output jest:
42
LE_CUP,
0
zamiast
42
LE_CUP
1
Może jakimś for
em szukając białego znaku i przecinka?