lkjh
lkjh
Last edited by elvar88; 11-12-2009 at 03:23 PM.
sleep(N) is a standard function that causes execution to pause (nicely) for N seconds.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Even if it were possible to create a predictable fixed delay using a for-loop (which it's not), that's not how you use a for loop anyway. The middle part of it is the continuation condition. You're saying that the loop should only continue whenever j is already 30.
You should state what OS you're using here. Windows has a Sleep function that sleeps for a number of milliseconds rather than seconds (and yes that's a capital S in this case).
main must return int, never void.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
We cant use sleep function for this project. any other ideas??
sleep() is not standard.
Are you using embedded hardware, or is this just something that runs on a normal PC? In embedded hardware, it's pretty common to just use busy loops for delays. Just take the machine instructions that are executed for every loop iteration, and calculate the total number of CPU cycles that are generated per loop iteration. Then divide that into the clock speed to figure out how many loop iterations you need to sleep for the specified amount of time.
bit∙hub [bit-huhb] n. A source and destination for information.