当前位置:网站首页>How to implement backspace in shell

How to implement backspace in shell

2022-07-07 16:01:00 __ pop_

man ascii  can   find out  
Oct   Dec   Hex   Char
───────────────────────────────────────────
010   8     08    BS  '\b' (backspace)
040   32    20    SPACE
177   127   7F    DEL

 These three characters are our focus 
  • backspace Both sides involved
 Initiating side  
	 Press down   Physics Backspace  Key 
 Operation side  // xshell  Corresponding to the operation side 
	 Erase the last character 

//  The general process is   The operator heard   Initiate side action ( It involves a putchar)
//  Operation side   Erase the last character  ( It involves three putchar)

Actual operation

 Initiating side 
	putchar(0x7F);
 Operation side 
	putchar(0x08);
	putchar(0x20);
	putchar(0x08);
原网站

版权声明
本文为[__ pop_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071328199372.html