[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1056
  • Last Modified:

no echo for a password field

  I'm on a unix system running "SunOS Release 4.1.2 (GENERIC)" on a Sun SPARC station 670MP.  I'm using the GNU project C and C++ Compiler (v2.4).
   I need to get keyboard input and store it without echoing the typed characters to the screen like in a password prompt...
   I've recieved many suggestions (on IRC) telling me to use the getchar(), getch(), getc() functions.  When I use these, however, I can still see typed characters...
   I've also tried changing the text color with textcolor() to that of the background, but the compiler I'm using doesn't have the conio.h header file.  
   If you have any suggestions let me know, please tell me the header files and libraries required to do this.
0
GBurk
Asked:
GBurk
1 Solution
 
evilgregCommented:
Have you tried curses?

#include <curses.h>

initscr();
noecho();
/** Grab password **/
echo();


Of course, there is a lot more to curses than this, but it's worth the effort to learn.

Make sure to compile with "-lcurses".

Try man curses or man 3 echo for more...


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now