How can I write some code to handle key presses without using an external library? Not sure if this is even possible. Just I can do it using something like lets say SDL or what not. But yes its related to this for example - http://www.cplusplus.com/forum/beginner/4402/
On windows you can use. By using a message loop your able to continually poll and use Win32APi calls (GetASyncKeyState()) to get the key press information.