Can anyone shoe me an example code to encode an entered password in C.

for example: password=vista
when displayed to the user on screen when entering the password it should look like this *****

Can someone show me how this can be done, thanks

you'd have to get rid of the "type ahead input" from your terminal, which is controlled by the operating system.

the answer on how to do that in standard C, is you can't. there are some old DOS libraries out there that can, and there's a POSIX library for Unix, but it's dependent upon finagling with the operating system, and it's not standard C.

here in the 21st century, entering and hiding passwords is handled in GUI applications via callbacks.

okay, if you're on windows, get the old DOS library <conio.h> ... if you're on *nix, get the posix terminal library <termio.h>

it's not standard c, and it's not portable, but it will do what you want. there's plenty of examples on the interwebs.

Be a part of the DaniWeb community

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