Linux terminal does not display back-Linux general technology-Linux programming and kernel information. The following is a detailed description. From: Lake Building
I 've been trying to write a program segment and try to input something that doesn't show back, but I 've been getting stuck with some things (I'm actually lazy and playing games) until recently I have to add something to the company's code.
As a result, after a round of google, I finally found the answer because I was dizzy when I saw APUE. The code is very simple. First Use tcgetattr to get the existing attributes, and then set XXX. c_lflag & = ~ on the existing attributes ~ ECHO, and then use tcsetattr to set the new attributes. for functions related to two terminals, fd must be provided, which is 0 for stdin, I don't know why I couldn't write stdin directly yesterday. below, I have it.
PS: Is it better to paste the code? So we have the following: