How to read an input(string) from the user keyboard without displaying it on the I/S, but to disply a character that I specify like (*) instead of the actual inputted character.. and if possible to store the entry on array

right now, I can't find any replacement for getch() which is a nonstandard function and doesn't exactly do what I want..
getline() as far as I know can't hide the input..


Recommended Answers

Well done, you've realised there is no standard way to do that.

Your only option is to use a non-standard method, which is of course compiler and or OS dependent. Do you wanna see it?


Jump to Post

All 3 Replies

Thanks for your response,
what's driving me crazy is getch() is being taught at college..it's non-standard and they didn't mention anything about that !

Yeah well there ya go. It probably doesn't matter until you hit the real world. Schools just try to teach the fundamentals, logic etc, and pseudo code.

There are too many pitfalls persistent in c/c++ to catch out the unwary. You only get to know about them with experience.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.