How to parse a char array?

I was wondering if anyone has any suggestions on how I could parse a char array into multiple int variables (without using StringObject) using the "white space" between the numbers. My char array has 5 sets of integer numbers which always have different lengths, but are always separated by a space. For instance:

char datain[49];
snprintf(alldatalines, sizeof(alldatalines), "023 4 567 8941 36");

How could I break this up so as to get the following?
int num1 = 23;
int num2 = 4;
int num3 = 567;
int num4 = 8941;
int num5 = 36;

Thanks!

strtok?

Thanks AWOL! Your little nudge in the right direction was all I needed. Here's what I came up with (that seems to work well):

    val1 = strtok(datain," ");
    val1int = atoi(val1);
    Serial.print("val1 = ");
    Serial.println(val1int);

// repeat for each "section" of string

sscanf also works.

sscanf(datain,"%d %d %d %d %d",&num1,&num2,&num3,&num4,&num5); works

Cool! Thanks Ken & SurferTim. I had not heard of sscanf before. It works like a charm! Love this new trick I learned about today :wink:

And again a wonderful post about what I've bin searching for for ages. Thanks! Google seems to be working good haha