A timer or sleep method

Hey experts,

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

       for(i=0;i<NUM_JPEGS;i++)
      {
            infile.read(jpeg_size[i],JPEG_HEADER_SIZE);
            int jpegSize = atoi(jpeg_size[i]);
            char* cur_jpeg = new char[jpegSize];
            infile.read(cur_jpeg,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);

            outfile.write(rtp_header,RTP_HDR_SZ);
            outfile.write(jpeg_size[i],JPEG_HEADER_SIZE);
            outfile.write(cur_jpeg,jpegSize);
      }

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??
LVL 3
mte01Asked:
Who is Participating?
 
Dariusz DziaraConnect With a Mentor ProgrammerCommented:
Sleep(100);
0
 
Dariusz DziaraProgrammerCommented:
I hope you meant Windows platform
0
 
mte01Author Commented:
>>mrblue

Yes, I am using windows platfrom...in which header file is this Sleep method found??
0
 
mte01Author Commented:
>>mrblue

I found it...it's <windows.h>...thx for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.