Don't use scanf / fscanf perhaps?
I dunno - why don't you check the return result of functions?
Using anything other than fgets() to read input is basically a waste of time IMO. It simply leads to more problems, and there's the whole "get rid of surplus newlines problem" - ick ick ick....
Here,
Code:
#include <stdio.h>
#include <stdlib.h>
void guessSquare(char *row, unsigned int *col, unsigned size);
int main(void)
{
char rSquare;
unsigned int cSquare;
unsigned int size = 0;
guessSquare( &rSquare, &cSquare, size);
printf( "%c %u\n", rSquare, cSquare );
return EXIT_SUCCESS;
}
/*************************************************/
void guessSquare(char *row, unsigned *col, unsigned size)
{
char buff[BUFSIZ];
int valid = 0;
while ( !valid &&
fgets( buff, sizeof buff, stdin ) != NULL ) {
if ( sscanf( buff, "%c, %u", row, col ) == 2 ) {
if ( *row >= 'a' && *row <= 'f' ) {
valid = 1;
}
}
}
}