I have thought about this problem before: You can use getchar. ch=getchar(), the value of ch is judged every time it is input. If the backspace escape character 'b' can be overwritten by direct output. If it is the completion of TAB key, store what you want to complete in the array, and then match it. The specific form is 1. Output a matchable character on the next line of the current cursor. If you want to match, enter the Enter key or the like. Otherwise, ignore it. Here you need to get and save the current cursor position, and then jump to The next line should also be deleted after the prompt string is displayed. blabla. . 2. Press the TAB key to directly output the matching string. To save the original point, if the user presses 'esc', the original string will be returned, record the number of matches, and just output 'b'. If you continue to press TAB, the current one will be output, and the matching next one will be output.
There are several functions for reference: getch() // conio.h The characters entered will not be displayed on the screen, similar to password input in Linux. ssprintf() Modify characters to get the console cursor position, etc. . . .
My previous collection of articles, "How to enter the password using cmd first to display the * number" http://www.cnblogs.com/jiangkun86/archive/2011/09/19/2181910.html
GNU Readline Library - Programming with GNU Readline
I have thought about this problem before:
You can use getchar. ch=getchar(), the value of ch is judged every time it is input.
If the backspace escape character 'b' can be overwritten by direct output.
If it is the completion of TAB key, store what you want to complete in the array, and then match it. The specific form is
1. Output a matchable character on the next line of the current cursor. If you want to match, enter the Enter key or the like. Otherwise, ignore it. Here you need to get and save the current cursor position, and then jump to The next line should also be deleted after the prompt string is displayed. blabla. .
2. Press the TAB key to directly output the matching string. To save the original point, if the user presses 'esc', the original string will be returned, record the number of matches, and just output 'b'. If you continue to press TAB, the current one will be output, and the matching next one will be output.
There are several functions for reference:
getch() // conio.h
The characters entered will not be displayed on the screen, similar to password input in Linux.
ssprintf()
Modify characters
to get the console cursor position, etc. . . .
My previous collection of articles, "How to enter the password using cmd first to display the * number"
http://www.cnblogs.com/jiangkun86/archive/2011/09/19/2181910.html