Simple Question

This is a discussion on Simple Question within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I want a user to at anytime press a key and it will do something (ie: 'h' for help, etc.) ...

  1. #1
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001

    Simple Question

    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.
    PHP and XML
    Let's talk about SAX

  2. #2
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    >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.

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    317
    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 *.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 09:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-21-2005, 12:41 AM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 12:15 PM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 06:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21