How do I build an event-driven console application?
Noice.
What do you mean by event-driven?
Also feel free to ask the other questions you had posted to math here, I'll try and answer as best I can (I already deleted them over there—stack traces, errors vs exceptions, etc).
No, I mean specifically as it pertains to a console app. What kinds of events do you have in mind, that kind of thing.
keypresses :-D
I'm aware of what event-driven programming is; it's how dynamic web pages work! :)
Ok, gotcha. You'll probably want to look into one of two libraries. One is called GNU readline -> http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html . I believe it provides the ability to hook into keypresses. The other is ncurses, which is designed for full-blown GUI-like apps in the console -> http://www.gnu.org/s/ncurses/ .
Are they like conio.h
They're probably a bit more advanced than conio.
Yeah conio is deprecated :-P
It's also for MS DOS hehe. The thing I don't know is whether either work with DOS/the Windows shell. They may be UNIX only, and thus require at minimum cygwin on Windows.
Join our real-time social learning platform and learn together with your friends!