--- In [email protected], Gopi Krishna Komanduri
<[EMAIL PROTECTED]> wrote:
>
> Hi Frnds,
> I strucked up with some very basic and simple prog.
> Could anyone of you please help me out. I need to write a
> code in such a way that , The code should call a function
> which prints some random number for every 10 seconds.
> The issue what I am facing is once the control; goes into
> function , initially I can get the starting time. But I
> am unable to solve how my system will lemme know after
> 10 seconds. I don't want to implement threads concept.
> I don't want to ping time for every moment ( for
> optimisation purpose) .

That requires you to first tell us what OS you work with, what
compiler, what IDE. Only then we can give you any educated advice.

For example, if you work with a console application for Unix/Linux,
then you don't have much of a choice but to implement a multi-threaded
application; at least not that I know of.
On the other hand, if you work with Windows, then you can simply add a
timer to your program which rings every ten seconds; then your main
event loop will simply have to react to these messages accordingly.

You see, the possible approaches heavily depend on OS and environment.

Regards,
Nico

Reply via email to