Platform Independent Deck Independent Detection in C ++

微信扫一扫,分享到朋友圈

Platform Independent Deck Independent Detection in C ++

In a C++ console program, I’ve found how to detect and arrow key on Windows, and I’ve found a lot of other stuff that had nothing to do with the question (despite what I thought were good search terms), but I want to know if there is a platform-independent way to detect an arrow key press. A decent second place for this would be how to detect arrow key press in unix and mac. Code fragments would be appreciated.

There’s no cross platform way to do it because it’s not defined by either C or C++ standards (though there may be libraries which abstract away the differences when compiled on different platforms).

I believe the library you are looking for on POSIX boxes is curses
, but I’ve never used it myself — I could be wrong.

Keep in mind that it’s entirely possible the console program (i.e. gnome-terminal
or konsole
or xterm
) has monopolized the use of those keys for other functions.

微信扫一扫,分享到朋友圈

Platform Independent Deck Independent Detection in C ++

破解网易易盾在小程序上成功购票的过程

上一篇

Redis Sentinel基本实现原理

下一篇

你也可能喜欢

Platform Independent Deck Independent Detection in C ++

长按储存图像,分享给朋友