validating a date month and year format
Hi guys im having trouble with validating user input for a date formal as
dd/mm/yyyy
I am using sscanf() function to read in the values but as soon as it hits the sscanf() function it reads the integer values but does not go and execute the next lines so it can validate the day,month, and years ranges using the if statements. Any idea's?
Code:
if ( sscanf( buff, "%d/%d/%d", &date, &month, &year ) == 3 )
{
if((date <=0) && (date>31))
{
printf("please enter the date again!");
}
if(month <0 && month>12)
{
printf("enter the months again please!");
}
if(year <1970 && year>2005)
{
printf("please enter the year again!");
}
}