0

Hi,

I'm a new one for c++. I want to call a function in time intervals. (as an example lets say for every 100ms ). How can I do that. Please help:S
Thank you

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by Nemoticchigga
0

If you get the boost libraries you can put that function in another thread and then have it wake up every XXX milliseconds or so. Don't expect very accurate timeing because that will not happen on multi-process operating systems like *nix and MS-Windows.

There are other ways too, some os dependent and some not. None of them are very nice.

-1

in dos.h file you will find function told
delay that takes time as argument i think it will be useful for you

Votes + Comments
Two steps forward, three steps back.
0

dos.h is only supported bo borland's TurboC and TurboC++ compilers, Microsoft VC q1.52C (and earlier), and maybe some very old versions of Watcom C. No other compilers has it. All those compilers are dead in the commercial world and only used by hobbiests today.

0

There is a sleep function in windows. For example:

Sleep(100); //will sleep for 100 ms and then wake up

You can use this to call your function every x ms.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.