0
How can I make one split of a string per semicolon and take the value of each position after the while
?
Example:
result[0] //casa result[1] //carro
My code:
char str[] ="test;car;bar;mouse";
char * pch;
string result;
pch = strtok (str,";");
while (pch != NULL)
{
result += pch;
printf ("%s\n",pch);
pch = strtok (NULL, ";");
}
printf("value by position 0\n", result[0]);
But it’s not C++? Why is it programmed in C?
– Maniero
Batatei putting C++. Thanks friend.
– Daniel Augusto