Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool PasswordPrompt(TCHAR *Buffer, size_t Count)
- {
- int TypedChar;
- size_t Caret;
- ::memset(Buffer, 0, sizeof(TCHAR) * Count);
- Caret = 0;
- for(;;)
- {
- TypedChar = ::_gettch();
- switch(TypedChar)
- {
- case 3:
- ::memset(Buffer, 0, sizeof(TCHAR) * Count);
- ::_puttch(_T('\n'));
- return false;
- case 8: // BACKSPACE
- if(Caret > 0)
- {
- Buffer[--Caret] = 0;
- ::_puttch(8);
- ::_puttch(_T(' '));
- ::_puttch(8);
- }
- break;
- case 13: // RETURN
- ::_puttch(_T('\n'));
- return true;
- default:
- if(TypedChar >= 32)
- {
- if((Caret + 1) < Count)
- {
- Buffer[Caret++] = TypedChar;
- ::_puttch(_T('*')); //::_puttch(TypedChar);
- }
- }
- break;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement