Hide password input on terminal

后端 未结 15 1355
清酒与你
清酒与你 2020-11-22 09:55

I want to mask my password while writing it with *. I use Linux GCC for this code. I know one solution is to use getch() function like this

15条回答
  •  隐瞒了意图╮
    2020-11-22 10:33

    Unfortunately in the C standard library there is no such function out of the box. Maybe in third party library.

    One option is use ANSI escape sequences to set the background color to foreground color in the console to conceal the password. Try this link.

提交回复
热议问题