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