PDA

View Full Version : Simple Question



Waldo2k2
07-15-2002, 10:50 AM
I want a user to at anytime press a key and it will do something (ie: 'h' for help, etc.)
I can cin, but the user would still have to wait for the opportunity to enter the command, i want them to be able to do it at anytime, sort of how mouse clicks work in windows programming.

Second,
can functions return arrays? IE: char[] mainMenu(void); ?
or would it just be char mainMenu(void); (it will be a c style string so that's why i thought char wouldn't work) if I can't use the array, i'll just convert to a string.

Hillbillie
07-16-2002, 05:03 PM
>I want a user to at anytime press a key and it will do something (ie: 'h' for help, etc.)
I can cin, but the user would still have to wait for the opportunity to enter the command, i want them to be able to do it at anytime, sort of how mouse clicks work in windows programming.<

You can accomplish this by TSR or interrupts in protected mode.

Traveller
07-16-2002, 06:50 PM
Second, yes you can. Keep in mind that if you declare a char [] and then just return the name of the array, you are returning a pointer, aka char *.