Masking Passwords HELP NEEDED

Hello I am making a personal program that I can keep secret info, browse the web, play music, change the password, and a lot more. My problem is that when entering the password it won't let me use the backspace. (THE PASSWORD IS MASKED.)
Is there any way to make the backspace not be counted as a char and actually delete a char?


Please help me and thank you in advanced for anyone who does help.
Sounds Illegal.Hmm.I Know The Answer To That,But Do Not Actually Use It.
Why not tell me how and what sounds illegal? The only secrets are my passwords for other things like my website or computer.
Last edited on
See one of my password function.If you find something useful from it then take it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void Menu::prog_pass()
{
	clrscr();
	char pass[15]="\0",temp;
	gotoxy(22,12) ;
	cout <<"Enter program pass password : " ;
	for(int z=0;z<15;z++)
	{
		temp=getch();
		clreol();
		if(temp==(char)13)
		 break;
		if(temp==(char)8)
		{
		  z--;
		  pass[z]=NULL;
		  cout<<"\b";
		  clreol();
		  z--;
		  continue;
		}
		cout<<"*";
		pass[z]=temp;
	}
	if(!strcmp(pass,"akshit1994"))
	{
	  return ;
	}
	clrscr();
	gotoxy(25,12) ;
	cout <<"   WRONG PASSWORD!!!!     " ;
	getch() ;
	exit(0);
}
I did this with my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 while (c!=13) /* ENTER KEY */
    {
          c=getch();
          if (c!=13)
          {
			  if(c = (char)8)
				{
					c = NULL;
					cout<<"\b";
					clreol();
				}
                    Passcode += c;
                    cout<<"*";
                    }
          }

but I get this error:
error C3861: 'clreol': identifier not found

And I did include conio.h
Do you know how to make it work?
Dev-C++ does'nt include the whole conio library. Do you use it?
I use Visual studio.
Never mind I figured it out with what you gave me and with some other things online. I solved my problem.
good then.
I Mean,Didn't You Just Ask How To Change Passwords On Websites?That Is Illegal if That's what you Mean.But Anyways,You Need To Use An Addalce Character,Sort Of Like The '\n' Thing.I Forget Which One Though.Example:
1
2
3
4
#include <iostream>
int main(){
std::cout <<"He \n He";
}

Would Produce The Following Result:
He
He
Last edited on
I would use this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <conio.h>
#include <string.h>//may be called something else on your compiler

using namespace std;

int main()
{
  string pswd = "";
  char pswd_ch;
  cout<<"Enter password: ";
  pswd_ch = _getch();
  while(pswd_ch != 13){// ASCII 13 is enter
    switch (pswd_ch){
      case 8:
      pswd.push_back(pswd_ch);
      cout<<"\b";
      pswd_ch = _getch();
      break;
      default:
      pswd.push_back(pswd_ch);
      cout<<"*";
      pswd_ch = _getch();
      break;}//Yes, I know it's not secure, does it need to be?
  }
  if(pswd == "Demonstration"){
     cout<<"Good pasword. Accessing...\n";
     return 0;
     }
  else{
      cout<<"FAIL!!!";
      return 0;
     }
}


Then do what you want with it. For example, instead of my literal in the password check, use a string, call it right_password or something like that. Have it defined in a hard-to-open file where the program can go get it (#include <fstream>). Then, under the password change section, use the same principle using getch() instead of _getch() and ignoring the cout in the password check.
Last edited on
Topic archived. No new replies allowed.