[try Beta version]
Not logged in

 
hide cin

Feb 7, 2012 at 11:03am
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++
Feb 10, 2012 at 3:28pm
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??
Feb 10, 2012 at 3:30pm
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.
Feb 11, 2012 at 10:10am
do you know what is the return value for this?
Feb 11, 2012 at 5:39pm
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?
Feb 12, 2012 at 3:00pm
i put that code inside a function,, and a warning goes that function needs a return value.
Feb 12, 2012 at 5:23pm
You return whatever you want to return. You ARE creating the function, so you must know what to return.
Feb 25, 2012 at 9:13am
using the code above... what should i do to make my input be normal again? not hidden?
Topic archived. No new replies allowed.