A timer or sleep method

Posted on 2006-04-30
Last Modified: 2010-04-01
Hey experts,

 I am reading data from a file in the following loop:

            int jpegSize = atoi(jpeg_size[i]);
            char* cur_jpeg = new char[jpegSize];

            rtphdr.seq = (unsigned int)(i+1);
            rtphdr.ts = (unsigned int)time(0);
            rtphdr.ssrc = RANDOM_INT;
            char* rtp_header = new char[RTP_HDR_SZ];
            memcpy(rtp_header, &rtphdr, RTP_HDR_SZ);


I want each iteration of the loop (starting from the 2nd one) to be preceded by a 100 ms delay; I guess this can be done by using a timer or a sleep method; I've done this before in java, but I don't know how to do that in C++...any help??
Question by:mte01
    LVL 8

    Accepted Solution

    LVL 8

    Expert Comment

    I hope you meant Windows platform
    LVL 3

    Author Comment


    Yes, I am using windows which header file is this Sleep method found??
    LVL 3

    Author Comment


    I found's <windows.h>...thx for your help!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
    C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (…
    The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now