sscanf() string version question
I'm trying to get this code to read errors that are not positive integers. Right now if you type 50394e,for example, it won't catch the "e" as an error. I think the sscanf line has to change the string it's reading to only include positive intergers, but I'm not sure what to change it too. Minor help would be appreciated.
Thanks,
mattflick
Code:
#inlcude <stdio.h>
int main(void)
char line[MAXLINE];
int error, n;
do {
printf("Input a positive integer: ");
fgets(line, MAXLINE, stdin);
errors = sscanf(line, "%d", &n) ! = 1 | | n <= 0;
if (error)
printf("\nERROR: Do it again.\n");
} while (error);