im making a timer program. that when a user dont input something in a specific time. the program will go to another menu

so far in my research. threads would be the solution to this. but in my current status right now as a c++ programmer. i dont think im capable of handling threads yet.

any suggestion to how to solve this problem would be greatly appreciated..

ps

dont want to use third party. im not allowed to use them

you could use some os-specific api calls such as Sleep()(ms-Windows) or sleep() (*nix) in a loop to delay a bit then check for keyboard hit.

whats the function that waits for a keyboard input?

in assembly i know that there is a code to doesnt need to press enter to input. it you can loop it so it can act like a timer. but whats the equivalent code for c++?

I don't know of any C/C++ function that waits for user input for a finite/specified time.
Which means you'll have to use multi-threading for sure.
See this thread if it helps.

the link leads you to an error page.

if i have no choice at all i will use multi threading. or just dump this feature in my program.

Perhaps start by saying what kind of program you're writing (console, GUI) and for which Operating System.

It's really hard to make sensible suggestions without a decent level of background information.

its a console based and windows operating system

the link leads you to an error page.

if i have no choice at all i will use multi threading. or just dump this feature in my program.

Found it using a search.. anyway if you look at the URL you would've figured what the problem is !
Here is the updated one: http://www.daniweb.com/forums/thread71946.html

sorry dude. anyway the link was kinda helpful thanks.

threads are still my last option. anyway tomorrow if i dont find one il have to learn threading

depending on the compiler there is a non-standard function in conio.h kbhit() that returns true if there is a key waiting at the keyboard buffer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.