Hi Again. I have a password field in one of my programs. I would like to display the letters as a *. Does anyone have some code to achieve this?

I think your going to have to give more detail here...Are you using MFC? If so then a password box will automatically do this....

Again we really need more information

Chris

commented: Yes we do :) +26

Scan keyboard state, read keys till Return pressed.

Like:

string pword;
string pkey = "testing";
cout << "Please enter the password";
<<endl;
cin >> pword;

You could do it (quite unstandardly) via

#include <iostream>
#include <string>

// Non-standard library
#include <conio.h>

int main() {
  std::string password;

  std::cout<< "Enter password: ";
  for( char ch=getch(); ch != 0x0D; ch=getch() ) {
    password += ch;
    std::cout<< "*";
  }
  std::cout<< "\nThe password is: " << password << "\n";

  return 0;
}

0x0D is hex for return, I think.

> Again we really need more information
Specifically, your operating system and compiler.

And try to be more specific than say "windows" and "borland", as there are many versions of both.

Ok, sure thing. I'm using Windows XP and My complier is the one that comes with Dev-C++, Mingw I believe.