timed user input
I am writing a C program where I have to ask user to input under a certain time. It should ask user for input for 5 counts or so. Whether the user enters anything or not, it should halt getting the input and proceed further with the program.
I am doing this by taking the help of uscos II multitasking. I have two tasks, one to get the user input and another to keep updating counts.
I am able to use if and while statements to get user input for certain period of time, but when the time finishes it just terminates the whole program, sometimes it also gives error related to memory. It is expected since I have not implemented anything which will automatically stop getting user input after certain period of time. Is there some specific function to do this?
Thanks in advance!
i have no idea what uscos II multitasking is but
you need 3 processes 1 for main program 1 for timer 1 for user input if timer goes out end the user input process.
or you can do it with threads the c program process envokes a process containing 2 threads 1 for timer 1 for user input, when timer thread joins the main thread, force the user thread to terminate.
You probably should have used google before you wasted your breath then; looks like this is for an embedded system.
Originally Posted by creeping death
so what? the main idea is that 2 "tasks" or "processes" wont be enough...
Okay BUT if you had googled (read the OP again) I bet you wouldn't have jumped the gun like that.