It works for the first time but when it loop nothing is stored wondering whats wrong
could someone help me out please?
void main ()
{ char buffer[256] = {0};
char password[] = "test";
char c,i=0;
int pos = 0;
do
{
buffer[0]='\0';
printf("%s", "Enter password: ");
do {
c = getch();
if( isprint(c) )
{
flushall();
buffer[ pos++ ] = c;
printf("%c", '*');
}
else if( c == 8 )
{
buffer[ pos-- ] = '\0';
printf("%s", "\b \b");
} } while( c != 13 );
if( !strcmp(buffer, password) )
printf("\n%s\n", "Logged on succesfully!");
else
printf("\n%s\n", "Incorrect login!");
i++;
}while(i!=5);
}