I am trying to take RGB codes entered by a user in the format #1, #2, #3. I error check the input to make sure it matches the ', ' format and can extract the numbers from the string. However, I am having trouble checking if the input is a number after that.
Ex: If the user enters: 255, 0, 0f the program still runs.
Any help would be appreciated!
char input[100];
printf("Enter RGB code \n");
scanf(" %[^\n]s", input);
//function to error check ', ' format
int c1,c2,c3;
//formats the input into three ints.
sscanf(input, "%d, %d, %d\n", &c1,&c2,&c3);
I just need to check if these are in fact integers