Hi there,
I'm having a problem with the gets and scanf functions. Is there some sort of clash between them?
My program asks the user to select a type of program usage then enter a string input (roman numerals). The code I have so far is:
Code:
#include<stdio.h>
#include<string.h>
void main()
{
int selection;
char number[10];
printf("MENU\n 1 - Number Entry Mode\n 2 - Batch Mode\nPlease choose an option...");
/*this scanf is messing up the gets below!!!*/
scanf("%i",&selection);
printf("\nPlease insert your number...");
gets(number);
printf("You entered: %s\n",number);
}
This code seems to ignore the gets(number) all together. However if I comment out the scanf it will perform the gets function.
I've been thinking about it for about a day now and I have no idea why it is doing it.
Any help would be much appreciated.
Dave.