I have some trouble with the do-while statement. The program is supposed to be some kind of interactive shell, e.g. if you press 'h' you get help options, if you press 'q' you exit the program.
I used std::getline(). So the problem is solved. However, I still don't get the problem with std::getchar() since it reads into char cmd. Even if it read more than one char cmd can't store more than one char. So how does the newline character get into cmd?
It reads the first character, does the action, then reads the leftover newline, fails, then reads you next char, and so on. The input that wasn't read (the newlines and such) don't disappear when you don't read them immediately; they wait until your next read.