Der Code funktioniert mit libstdc++, aber mit libc++.
Beim Drücken der NACH-OBEN-Pfeiltaste erhalten Sie die Ausgabe 1b 5b 41
- bei Kompilierung mit g++ -std=c++23 rawkey.cpp oder clang++ -std=c++23 -stdlib=libstdc++ rawkey.cpp. Das ist richtig.
- erhalte 1b-Ausgabe, wenn mit clang++ -std=c++23 -stdlib=libc++ rawkey kompiliert wird. cpp
Code: Select all
#include
#include
#include
#include
using namespace std;
void get_raw_key()
{
auto buf = cin.rdbuf();
vector keys;
string endline("\r\n");
auto pump_buf = [&]() {
cerr sbumpc()); // buf->sgetc() buf->sbumpc() getchar() cin.get()
while (buf->in_avail() > 0)
keys.push_back(buf->sbumpc());
};
auto dump_key = [&]() {
stringstream str;
for (const auto num : keys)
str