This only works for Unix variants though. I don't think there is a cross-platform way.
这仅适用于Unix变体。我不认为有跨平台的方式。
#4
2
A couple years ago I wrote a small library to do this in a cross-platform way (inspired directly by John Millikin's answer above). In addition to getch, it comes with a pause function that prints 'Press any key to continue . . .':