how to check the scanf function if it will read more than one number
- From: "moosdau" <moosdau@xxxxxxxxx>
- Date: 2 Jan 2006 02:05:36 -0800
my code:
do
{
printf("please input the dividend and the divisor.\n");
if(!scanf("%d%d",&dend,&dor))
{
temp1=1;
fflush(stdin);
}
else
temp1=0;
}while(temp1==1);
it seems that it only depend on the first number it read.
if I input " a 32 ", it could know there is a error,
but if I input " 32 a ",
it accept that.
thanks in advance.
.
- Follow-Ups:
- Prev by Date: Re: gets() - dangerous?
- Next by Date: Re: gets() - dangerous?
- Previous by thread: Re: Writing a specific program
- Next by thread: Re: how to check the scanf function if it will read more than one number
- Index(es):