Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 30-09-2009
Member
 
Join Date: Apr 2009
Posts: 79
Delay in execution of C program?

I want to write program for implementing long time (200ms) delay in execution of loop in C language, can you give some good advice? Is that any syntax to put put a delay of milliseconds or seconds at any step in a C program.
Reply With Quote
  #2  
Old 30-09-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Delay in execution of C program?

Creating a software loop to generate time delays in C for each loop which delay the execution. You could try something like :
Code:
for (i=0;i<35;i++) 
{ 
j=i; 
}
Reply With Quote
  #3  
Old 30-09-2009
Member
 
Join Date: Jan 2009
Posts: 199
Re: Delay in execution of C program?

You probably want to use usleep(microseconds) : > #include <windows.h> and use > Sleep(ms). *note the capital S*. In C Programming both Sleep(), sleep(), and SleepEx() all pause for milliseconds.
Reply With Quote
  #4  
Old 30-09-2009
Member
 
Join Date: Dec 2008
Posts: 177
Re: Delay in execution of C program?

Delay for 10 seconds example
Code:
#include <stdio.h>
#include <time.h> 
int main()
{
time_t start;
time_t current;

time(&start);
printf("delay for 10 seconds.\n");
do{
time(&current);
}while(difftime(current,start) < 10.0);
printf("Finished delay.\n");


return 0;
}
Reply With Quote
  #5  
Old 03-10-2009
Member
 
Join Date: Sep 2009
Posts: 3
Re: Delay in execution of C program?

click here to know more
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Delay in execution of C program?"
Thread Thread Starter Forum Replies Last Post
WMI execution is different in windows 7 $Lola$ Operating Systems 4 22-02-2011 08:42 PM
Make a program behave on the basis of input given dring execution Karumbu Software Development 4 29-12-2010 06:49 AM
Execution of program can not find the file Gunner 1 Software Development 5 13-01-2010 11:42 AM
need help making time delay start for program Brandon 2010 Software Development 3 22-06-2009 08:08 AM
Why C, C++ program execution starts with main() RadhaV Software Development 4 13-02-2009 08:08 PM


All times are GMT +5.5. The time now is 08:48 PM.