| re: time delaying?
"Sargo" <sargo001@chartermi.net> wrote...[color=blue]
> Im fairly new with C++ and i havent been able to find an answer anywhere
> else so far, so I'm asking here.
>
> I'm looking for a way to do a time delay. What I mean by this is where
> the
> code outputs a line to the screen (console app) and then waits say... 5
> seconds and then prints out the next line.
>
> Is this possible? Thanks in advance[/color]
Yes, something like
cout << "a line" << endl;
time_t t1 = time(0), t2;
do
t2 = time(0);
while (_difference_in_seconds_(t1, t2) < 5);
cout << "the next line" << endl;
Now, you will somehow have to implement _difference_in_seconds_
function, RTFM about 'localtime' function.
If you don't mind to be OS-specific, you can probably use some kind
of OS-specific way to introduce a delay. You will have to ask in
a newsgroup dedicated to your OS (whatever that is).
Victor |