Code:
char fractionOne[FR_MAX_INPUT+1];
char fractionTwo[FR_MAX_INPUT+1];
char *p;
long x, y;
printf("Fractions\n");
printf("------------------\n");
printf("Enter fraction #1: ");
fgets(fractionOne, FR_MAX_INPUT+1, stdin);
/* test to makesure that we have ALL of the line */
if(fractionOne[strlen(fractionOne) - 1] != '\n') {
/* the newline must be in the buffer */
readRestOfLine();
} else { /* get rid of the new line from the input */
fractionOne[strlen(fractionOne) - 1] = '\0';
}
x = strtol(fractionOne, &p, 0);
while(isspace(*p || *p == '/')) p ++;
y = strtol(p, NULL, 0);
printf("x is %d\n: ", x);
printf("y is %d\n: ", y);