Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

A timer or sleep method

Posted on 2006-04-30
4
Medium Priority
?
268 Views
Last Modified: 2010-04-01
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??
0
Comment
Question by:mte01
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
mrblue earned 1920 total points
ID: 16571957
Sleep(100);
0
 
LVL 8

Expert Comment

by:mrblue
ID: 16571963
I hope you meant Windows platform
0
 
LVL 3

Author Comment

by:mte01
ID: 16572079
>>mrblue

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

Author Comment

by:mte01
ID: 16572091
>>mrblue

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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

810 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