How to use strtok

Hello, please help me...

I have a problem with strtok

char a[5] = "1.2";

I get number "1" use printf("%s", strtok(a, "."));
but how to get number "2" with strtok ?
closed account (zb0S216C)
Try this:
1
2
3
4
5
6
7
8
9
10
11
#include <cstring>
#include <stdio.h>

char a[ 5 ] = "1.2";
char *pToken( strtok( a, "." ) );

while( pToken != NULL )
{
     printf( "Character: %s", pToken );
     pToken = strtok( NULL, "." );
}
Topic archived. No new replies allowed.