Thread: Event driven console application

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    5

    Event driven console application

    Has anyone come across a relatively simple event management class that can be used in a console application?

    Here is what I want to do:

    (1) The main function would wait for event and dispatch the actions based on event type:

    Code:
    main()
    {
      while (event) {
        do something 
      }
    }
    (2) The events would be triggered by various functions implemented in the application, eg.

    Code:
    function1() 
    {
      trigger event1
    }
    
    callback1() 
    {
      trigger event2
    }
    Typical scenario that the app will be running is something like this:

    generate event (read stdin) -> do something that returns callback -> callback triggers next event (eg. next line from stdin) -> do something that returns another callback -> ...

    This is supposed to be a multi-platform app so I would like to keep it close to standard C++

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    The nearest you're going to get to multi-platform is using ncurses on your POSIX hosts, and pdcurses on Win32
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. simple snmp console application.
    By csteinsv in forum C++ Programming
    Replies: 0
    Last Post: 06-01-2009, 05:03 PM
  2. Replies: 7
    Last Post: 01-14-2008, 10:25 AM
  3. icon in win32 console application
    By osal in forum Windows Programming
    Replies: 3
    Last Post: 06-30-2004, 02:13 PM
  4. Console Application
    By Mont_Blanc in forum C++ Programming
    Replies: 3
    Last Post: 04-17-2004, 03:07 AM
  5. Move cursor in console application
    By alfa in forum C# Programming
    Replies: 2
    Last Post: 02-09-2003, 02:58 PM