you can use "sscanf" , "man sscanf " for an example .
Here i give you a simple Example:
char* strTemp = "123,456,789";
int iFisrt = 0;
int iSecond = 0;
int iThird =0;
scannf(strTemp, "%d,%d,%d",&iFirst, &iSecond, &iThird);