![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
masked input in c++
how can you make it so that in c++ when the user inputs stuff through cin it comes up as * instead of the actual text theyre typing? im trying to make a password thing.
__________________
Children in the dark cause accidents, and accidents in the dark cause children. http://www.ronincoders.org |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
oh im sorry never mind. somebody delete this thread.
__________________
Children in the dark cause accidents, and accidents in the dark cause children. http://www.ronincoders.org |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Well, did you figure it out?
|
|
|
|
|
|
#4 |
|
Programmer
|
I'm pretty sure you can delete your own threads, if you've been the only one to post thus far (which you were).
![]() |
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Yeah, but you only get half an hour.
|
|
|
|
|
|
#6 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4
![]() |
...but how do you mask input text?
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
You'd have to use the getch() function. What compiler and what OS are you using? It's different for each one.
|
|
|
|
|
|
#8 |
|
Highly Adaptive Penguin
Join Date: May 2005
Location: United States
Posts: 251
Rep Power: 4
![]() |
i have a digital mars compiler on windows. how would i use getch to do this, could you give em an example?
|
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
First off, you have to include conio.h if you're using C, or cconio if you're using C++:
#include <cconio> char c;
c = std::getch();
printf("*"); |
|
|
|
|
|
#10 |
|
Programmer
Join Date: Aug 2005
Location: 0x0010 * 0x0091 + 0x0004
Posts: 65
Rep Power: 4
![]() |
I've seen portable ways of doing this in C and Java. I know there is one posted on the java.sun.com forums somewhere, sorry I don't have the link. And also, the prototype of this function is declared as returning an int.
__________________
#if 0 /* in case someone actually tries to compile this */ <Jim_McNeat> Is there like a way to put a compiler in "Just trust me on that one" mode? |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|