i have the following function that asks the user to input their name. and stores it as one of the members of a struct called player name that can hold upto 10 characters including the \0 character.
Code:
void get_player_names(int num_of_players, Hand *p_player)
{
    int i, x;
    char buff[11];

    for (i = 0; i < num_of_players; i++)
    {
        printf("Please enter player %d's name: ", i + 1);
        x = 0;
        while (x != 1)
        {
            fgets(buff, sizeof(buff), stdin);
            flush_line();
            x = sscanf(buff, "%s", p_player[i].player_name);
            if (x != 1)
            {
                printf("Incorrect Entry\n Please enter player %d's name: ", i + 1);
                x = 0;
            }
        }
    }
}
the issue is i need the buffer to be the same size at least but if i input a shorter name it waits for me to input the remaining characters to fill the buffer.

is there away i can look at each character as it comes in using fgets and search for the newline feed
many thanks
coop