#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?
thanks in advance

New Topic/Question
Reply



MultiQuote




|