数値の行は以下みたいなドロくさい処理を4回繰り返せば良い

unsigned int n = 0;
do {
unsigned char ch = (unsigned char)(*data++ - '0');
if (ch <= 9)
{
n = n * 10 + ch;
}
else {
break;
}
} while (true);