hide cin

can some on help me to hide the input..
like for example a user would have to choose from the choices but his input will not be shown in the screen.. i try getline but it doesn't work.. by the way,, i'm using c++
i already figure it out,, but i don't know hoe to explain it to my defense...

HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode = 0;
GetConsoleMode(hStdin, &mode);
SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT));

can someone explain this to me??
Well, first of all, that is Windows-only code. Just so you know as this site also has a lot of *nix programmers.

Second, the thing is rather simple, hopefully:

1. Ask the Operating System (Windows) for the handle to the standard input.
2. Retrieve the current operation mode of this input stream.
3. Alter the operation mode by removing the bit that controls the echoing of data on input.
do you know what is the return value for this?
What is the return value of what?? There are 3 function calls there. The first one returns a handle, and the other two functions are documented in MSDN Online, along with their return values:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683167(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx

Or are you asking for some other return value?
i put that code inside a function,, and a warning goes that function needs a return value.
You return whatever you want to return. You ARE creating the function, so you must know what to return.
using the code above... what should i do to make my input be normal again? not hidden?
Topic archived. No new replies allowed.