Thread: event question

  1. #1
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80

    Question event question

    ok i was wondering whether there was any type of pause and process function like vb has DoEvents() which makes sure that everything stak'd or qued to be output or drawn has been drawn or output, for example in c++ (platform = dos) i enter a ticker loop and want the loop to say do any qued events before the equality is met,

    ok as im no good @ explaning heres an example (using half pseudo code):

    Code:
    while(ticks<lastticks+interval)
    {
    cout<<"hey";
    //like maybee a doevents here or a wait process
    }
    
    //this would output (say if it looped 10 times) hey*10  but at the 
    //end of the loop, how would i enable it to output hey 1 at a time 
    //after each cout?

  2. #2
    Shadow12345
    Guest
    again I find myself responding to a post no one else has responded to, and this is a dangerous thing because i cannot code my way out of a paperbag. With that said and done I don't really know what you are talking about, I have never heard of events being qued, and i wonder if that is something that is only implemented for visual basic stuff. i would really like to provide an answer for you, do you think you could provide more psuedo/C++ code in your little example so I can have a better idea of what you want done?

    //this would output (say if it looped 10 times) hey*10 but at the
    //end of the loop, how would i enable it to output hey 1 at a time
    //after each cout?
    if you want something that says 'hey' a certain number of times consider the following

    Code:
    int numprints = 0; //number of times 'hey' is outputted
    while(numprints < 10) {
    for(int x = 0; x < numprints; x++)
    cout << "hey"; //this prints it numprints amount of times
    
    numprints++; //as soon as numprints equals or is greater than 10, the while loop stops
    }

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Event queues have to do with the OS. Most OS's use something like an event queue. The real question is what would that have to do with:

    Code:
    std::cout << "whatever";
    ???


    If you want to handle events in real-time you are going to have to do some OS specific programming.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    One more thing. When you have code that looks like this:

    Code:
    // the #>> is just the line number
    1>> std::cout << "hello";
    2>> std::cin >> my_int;
    line 2 will not be done until line 1 has finished. I think you are simply asking if line 2 could start taking input before line 1 has finished its output? If so, the answer is no. When you get into more complicated stuff (such as the win api) you can come across issues reguarding this question, but even then it is rare.

  5. #5
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    i have programmed in the Win32 API for years ever since i programmed in vb;

    ok to specify, ive made a program in which it allows the user to program in my own language ( basically an enterpreter) and say if the user types:
    {program{start}{print{Hey!}{goto{15}

    it wldnt output anything it wld just infinite loop and not output anything or say if i put timer wait events seperating 3 print statements,it wldnt print 1 then wait then print 2, it wld wait wait wait then print 1,2 & 3 @ once, i will send u the code for my enterpreter if u want it maybee easier that way for u to understand my prob, it is coded in m$ c++ 6
    and il attach it to the next msg if it wld help in your understanding of my coding prob

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Python mod sched question
    By Overworked_PhD in forum Tech Board
    Replies: 2
    Last Post: 04-26-2009, 03:16 PM
  2. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 12:14 PM
  3. Replies: 2
    Last Post: 09-22-2003, 01:47 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM