|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Causing a delay in milliseconds
How do I cause the program to stop running for X amount of milliseconds?
Example, for(i=1;1<10;i++){ printf("%i\n",i); function_causes_100ms_wait; } Basically, I need a function that can pause the program. Couldn't find anything on Google or any books I have lying around.
__________________
|
|
#2
|
||||
|
||||
|
What platform are you programming on? I know that Sleep(...) works on Windows platforms.
I'm sure there is a similar function for Unix, but I don't know what headers (if any) you would need to include.
__________________
Jon Sagara "Me fail English? That's unpossible!" |
|
#3
|
|||
|
|||
|
If you are using unix, the function you're looking for is usleep, from unistd.h
usleep suspends execution for X microseconds. Code:
for(i=1;1<10;i++){
printf("%i\n",i);
usleep(100000);
}
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Causing a delay in milliseconds |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|