hehehe, got it to work but its probably not that portable, and i used a little bit of help with the usage of ioctl's. if you were to use only ncurses, it would probably end up being better ill try it later but here is that exakmple that works.
compile it with
g++ -o blah blah.cpp -lpthreads