Code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    while(1)
    {
    char *client_balance[]={"20000", "18000", "16000", "14000", "12000"};
    int client_num=2;
    char buf[6];
    start:
    system("PAUSE");    
    printf("Please type the new PIN:");
    fgets(buf,7,stdin);
    printf("%s\n", buf);
    client_balance[client_num]=buf;
    printf("%s\n", client_balance[client_num]);
    }
   
  system("PAUSE");    
  return 0;
}

My Input:
PIN: 123456789
Output:
123456
123456

then it does not wait for my input, it uses the "789" leftover from before,
How to fix this bug? Make it ask me for input each time and use the 6 digits i enter only?

i want the extra numbers to be discarded,
i.e
if first time i entered 123456789
i want before and after to have the first 6 digits
and next time, to ask for my iput again, so that i can enter new numbers