What is the purpose of this if statement in getch?
Closed this issue · 2 comments
dospunk commented
if (ch == '\r') {
ch = getchar();
}
I assume it's to deal with enter inserting \r\n
instead of just \n
, but I want to make sure that's correct
adam-mcdaniel commented
It's meant to prevent getch
from ever returning a '\r'
character. I mostly did this for compatibility between *nix and windows.
dospunk commented
Got it, thanks!