Hey everyone, im simply trying to get the user to enter the new username when creating a new account. Then, appending that information into the text file. My program does take the info and store it into the txt file. However, the problem is that the user's input does not show on the screen...
Also it counts backspace as a character and requires the user to press enter 2 times.
cout<<"Please enter the following information to confirm your identity!"<<endl;
cout<<"Enter your current username: ";
cin>>currentuser;
currentpass=getpass("Enter your current password: ",true);
//confirms the user's identity, allows the user to create a new account
if (currentuser==username&¤tpass==password){
cout<<"Identity confirmed!"<<endl;
cout<<"\nEnter the new username: ";
cin>>newuser;//This is the problem
newpass=getpass("\nEnter the new password: ",true);
//opens the text file
expassword.open("password.txt", ios::app);
//appened the new account info into the text file
expassword<<newuser<<endl;
expassword<<newpass<<endl;
}else{
cout<<"Incorrect username/password!"<<endl;
system("PAUSE");
}
//closes the text file
expassword.close();
Notice how my function does not mix WinAPI I/O and C++ stream I/O, and it does not hardcode ASCII values but instead uses the proper C/C++ escape codes for CR and BS.
It doesn't have the option to not use asterisks -- you can add that easily enough if you want, just like your routine does above.
(Ignore the other yahoo from "big IT firm " in that thread.)