Options...Might be advanced rather than new xD

Hallo Guys. Zanaj here.
I am new to this forum and I hope you guys can help me. I've made a simple 2d platform game.
I thought it would be a nice idea to give the user the option to change his/her's controlling keys, but how do you do this?
As far as I've heard the only way to check wht key is pressed is to make a loop that checks ALL keys and then pick what key is pressed and then write that to my ini file. Is this the only way? Or is there some libery that could make this easier for me?
Thank you. Have a nice day.
Sincerly Zanaj (:

Re: Options...Might be advanced rather than new xD

Why do you need to loop through all the keys?

There are a bunch of ways to do this. You could create a map of key presses to actions, for example. Detect which key was pressed, then look up which action it maps to and do the correct thing. No loops necessary.