best way to learn time based programming for c++?

Sharky Forums


Results 1 to 4 of 4

Thread: best way to learn time based programming for c++?

  1. #1
    Hammerhead Shark
    Join Date
    Jun 2003
    Posts
    1,019

    best way to learn time based programming for c++?

    you know how in basic programs, the program counter goes through each statement, and when it gets to an input, it just waits there
    so whats the best way to have it just check for input and move on if nothing is inputed?
    i have some experience doing this with premade functions and timers in a embedded systems class with c and vhdl but want to do this with c++ programs

    i get a hunch that directx sdk would have libraries for this with the direct input stuff but i would like a more simplified one to fool around with console programs until i learn directx this summer

  2. #2
    Tiger Shark Remington's Avatar
    Join Date
    Apr 2001
    Location
    Calgary, Alberta, Canada
    Posts
    702
    There are a bunch of functions in the standard library for processing command line and function parameters.

  3. #3
    Tiger Shark
    Join Date
    Jun 2001
    Posts
    860
    Using DirectX seems to be a very round-about approach. Hmm... there are probably better ideas than this, but you could create a multi-threaded application. One thread will be a loop which just waits for input and queues it. The other thread will be your "main" thread. Your main thread would simply check if said queue is empty or not. If it's empty, then there's no input and you can just continue.

    I don't know how familiar you are with multithreaded applications though. If you're not at all familiar, it is a somewhat steep learning curve, so maybe the DirectX approach would be easier for you? I don't know.

    Or maybe there are functions included in the standard C++ library which allows you to check if input exists before trying to read it in.
    Last edited by hu flung dung; 05-06-2007 at 06:13 PM.

  4. #4
    Hammerhead Shark
    Join Date
    Jun 2003
    Posts
    1,019
    ive tried searching for such standard functions and came up empty

    do you have anything more specific i should search for?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •