Advertisement

input

Started by February 08, 2003 04:12 AM
1 comment, last by ts0 22 years ago
hy! how can i get whole text-lines from the user and print it the same time to the screen and put the whole "line" in a string/... thx for help! i know one possibility to do that. by printing every key a bit more right and using strcat/... but i don´t think that source would be nice to read. anyone got better ideas? thx -------- ts0
--------ts0
look into scanf or gets
Advertisement
i would put this in WndProc, under WM_KEYDOWN.
you have wParam that is the key being pressed.
you can distinguish two cases:
1) you want to put in some cheats (i.e. non-terminated char sequence)
you should declare a char vector, shift every character to the left, and put at the end of the vector the pressed character, and then compare to whatever you want, starting from the end of the vector
2) you want a chat system (return key terminated string)
declare the char vector, and a counter.
each key pressed, store it in char[counter], increment the counter, until return is hit; then null-terminate the string, assign counter=0, and send the string to whatever function you want

This topic is closed to new replies.

Advertisement