use while(1) loop and inside the loop read one character at a time.
Break from the loop on getting something other that 0-9.
Handle the space explicitly.
If the numbers are multi-digit numbers you will have to use temp buffer to store the number till u get a space.
WaltP commented: Terrible suggestion -4
dkalita 110 Posting Pro in Training
dkalita 110 Posting Pro in Training
dkalita 110 Posting Pro in Training
dkalita 110 Posting Pro in Training
necrolin commented: Thank you +1
BestJewSinceJC commented: Thanks! Wish I could give you more rep. +4
crystality commented: fixed my problem +0
hmortensen commented: short and on the issue. +1