while 루프 내에서 키 누르기를 확인하기 위해 windows.h
을 사용하지 않는 코드 스 니펫을 가지고있는 사람이 있습니까? 기본적으로이 코드를 사용하려면 windows.h
을 사용하지 않아도됩니다. Linux와 Windows에서 사용하고 싶습니다.C++ : 키를 누를 때까지 while 루프를 실행합니다. Esc?
#include <windows.h>
#include <iostream>
int main()
{
bool exit = false;
while(exit == false)
{
if (GetAsyncKeyState(VK_ESCAPE))
{
exit = true;
}
std::cout<<"press esc to exit! "<<std::endl;
}
std::cout<<"exited: "<<std::endl;
return 0;
}
'의 S/GetAsyncKeyState (VK_ESCAPE)/GetAsyncKeyState (VK_ESCAPE) 0x8000'. – chris
@chris 죄송합니다. 무슨 뜻인지 이해가 안됩니다. – pandoragami
특정 키를 누르거나 키를 누르시겠습니까? –