I want to make a console program able to output text and do other things while a user is typing input. I'm going to use ncurses for the display. How could I do two things at the same time?
I want to make a console program able to output text and do other things while a user is typing input. I'm going to use ncurses for the display. How could I do two things at the same time?
off the top of my head
You can use select() on stdin to see if there is any data to be processed
hi eam,
you should take a look in fork() and clone() linux syscalls. they work similar to w32 threads.
jmgk
eam,
already tried http://www.google.com/search?q=linux+fork+syscall ?
or the linux secret command "man"?
jmgk
Actually fork() and clone() are NOT like windows threads. fork() creates another process with its own memory space. If you want multi threaded applications you need to look into pthreads
Guess I have some reading to do then, thanks for pointing me in the right direction.
Not to try and say that you are wrong Thantos, just to shed a little more light on the subject. Threads in linux are implemented as their own processes. They just so happen to have the same pid and their address space pointer points to the address space of the other process it is a thread of . They are called lightweight processes.
Help populate a c/c++ help irc channel
server: irc://irc.efnet.net
channel: #c