I have a simple console application in C++ that does some data archiving for Access database. I need to get user's input for a date, which I coded as follows:
printf("Please enter a date for archiving, in the format of yyyymmdd: ");
scanf ("%s", date);
date = '\0';
It worked fine if a date is entered (such as 20030226). The problem with the above is that if a user does not input anything, instead, just presses [Enter], the program will keep on waiting for the input, meaning, it stays at statement 'scanf ("%s", date);'. Please advise, or let me know if there is an alternate way to do so. Note that I'm not using STL.