If you call fgetc(HANDLE) multiple times you must clear buffer before, thus get all unwanted chars to the new new line character.
while (true) {
//clear buffer - read all unwanted characters
while(fgetc(STDIN) != "\n");
//get first character from STDIN
$first = fgetc(STDIN);
}