Dec 4th, 2000, 01:36 PM
For some reason, if you press basckspace a bunch of times, and then press "d" like 4 times, it wont return anything. Anyone know why?
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
void GetPass(char *input, int length)
{
char temp;
for(int i = 0; i < length; i++)
{
temp = getch();
if(temp == 13)
{
input[ i ] = 0;
break;
}
if(i > 0)
{
if(temp == 8)
{
putchar(8);
putchar(' ');
putchar(8);
input[--i] = 0;
i = i - 1;
}
}
if(temp != 8)
{
putchar('*');
input[ i ] = temp;
}
}
}
void main()
{
char input[100];
GetPass(input, 100);
cout<<endl;
cout<<input;
return;
}
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
void GetPass(char *input, int length)
{
char temp;
for(int i = 0; i < length; i++)
{
temp = getch();
if(temp == 13)
{
input[ i ] = 0;
break;
}
if(i > 0)
{
if(temp == 8)
{
putchar(8);
putchar(' ');
putchar(8);
input[--i] = 0;
i = i - 1;
}
}
if(temp != 8)
{
putchar('*');
input[ i ] = temp;
}
}
}
void main()
{
char input[100];
GetPass(input, 100);
cout<<endl;
cout<<input;
return;
}