I need to read two strings from stdin (keyboard) and save them to two char-variables.
I do not know why when I use "gets" on the beginning of the code it is function OK:
Code:
printf("Enter Date Time in format \"Jun 21 04\": ");
gets(date);
printf("Enter COM number (two digits): ");
scanf("%2s", num);
But when I change order of scanf and gets, this way:
Code:
printf("Enter COM number (two digits): ");
scanf("%2s", num);
printf("Enter Date Time in format \"Jun 21 04\": ");
gets(date);
than program not stops after "Enter Date Time in format "Jun 21 04":" User cannot put second string.
Could exist some solution for reading of string inside (not on the beginning) of code? I tried to use brackets {} but it does not help.
Thank you for your help.