|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
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. |
#2
| |||
| |||
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; } |
#3
| |||
| |||
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. |
#4
| |||
| |||
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(¤t); }while(difftime(current,start) < 10.0); printf("Finished delay.\n"); return 0; } |
#5
| |||
| |||
Re: Delay in execution of C program? |
![]() |
|
Tags: c language, loop, program |
Thread Tools | Search this Thread |
|
![]() | ||||
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 |