_getch() can return '\r' on Windows
This commit is contained in:
@@ -77,7 +77,7 @@ read_string(const char *preprompt, const char *prompt,
|
|||||||
p = buf;
|
p = buf;
|
||||||
while(intr_flag == 0){
|
while(intr_flag == 0){
|
||||||
c = ((echo)? _getche(): _getch());
|
c = ((echo)? _getche(): _getch());
|
||||||
if(c == '\n')
|
if(c == '\n' || c == '\r')
|
||||||
break;
|
break;
|
||||||
if(of == 0)
|
if(of == 0)
|
||||||
*p++ = c;
|
*p++ = c;
|
||||||
|
Reference in New Issue
Block a user