I'd suggest something more like:
Code:
void echofile(FILE *fp)
{
int n1, n2;
int count = 0;
char inbuffer[80];
while (fgets(inbuffer, sizeof(inbuffer), fp))
{
++count;
if (sscanf(inbuffer, "%d%d", &n1, &n2) == 2)
{
printf("Line %d: %d %d\n", count, n1, n2);
}
else
{
printf("Line %d is empty or has fewer than 2 numbers on it\n", count);
}
}
}
The "%d%d" (note, no whitespace between the two format specifiers) should work because sscanf() skips whitespace while finding the beginning of the value for each %d, so the first %d is terminated by the tab, the second %d skips the tab and is terminated by the end-of-line.