In article <11**********************@f14g2000cwb.googlegroups .com>,
lucifer <um**********@gmail.com> wrote:
i need to insert delay in my program what function should i use
the old delay is not supported by the VC6
As you posted to comp.lang.c, our answer will be in terms of
the features provided by standardized C. Anything VC6 should
be discussed in a newsgroup appropriate for VC6.
Standard C provides no delay functions at all. None. Not one.
Zero. Zippo. Null set.
The closest you can get to a delay function in C is a loop that changes
the value of a volatile variable that has external linkage.
If you looped changing a local variable, there is the risk that the
optimizer would optimize the loop out completely, but for volatile
variables it should assume that there might be -some- other
mechanism that might change the value, so it shouldn't optimize
out the loop.
This is, of course, a very crude delay mechanism, and the duration
of the delay will likely vary from run to run, and if you have
multiple calls within the same program you shouldn't expect that they
would delay by the same duration.
If you want any kind of accuracy or repeatability or calibration
of a delay duration, you will need to use some implementation-
dependant call that is outside the scope of the C standard.
--
Goedel's Mail Filter Incompleteness Theorem:
In any sufficiently expressive language, with any fixed set of
email filtering algorithms, there exists at least one spam message
which the algorithms are unable to filter out.