example of datevalidation
thanks fo that.. could you please give me an example im hopeless at c. lol id really appreciate it.
heres my code in full im getting compile errors with it
im kind of having problems with it im getting a token error.
thats my function
Code:
void ageCalculator()
{
char buff[BUFSIZ];
int m,d,y;
struct tm t;
time_t now;
time(&now);
t = *localtime(&now);
strftime(buff, sizeof(buff), "%Y//%m//%y", &t);
printf("Please enter your date of birth in (yyyy//mm/dd) format\n");
if ( fgets( buff, BUFSIZ, stdin ) != NULL ) {
int y,m,d;
if ( sscanf( buff, "%d/%d/%d", &d, &m, &y ) == 3 ) {
/* got 3 ints */
if ( d >= 1 && d <= 31 ) /* etc etc */
}
}
printf("The current date is %s\n",buff);
}