On 9/5/07, remarknibor <[EMAIL PROTECTED]> wrote:
> Rather than using threads, GUIs, etc., couldn't I just do the
> following:
>
>   time_t seconds1, seconds2;
>   char c;
>   string essay1;
>
>   seconds1 = time (NULL);
>   do {
>
>     if(kbhit()) {
>       c = getch();
>       essay1.append(1,c);
>       cout << c;
>     }
>     seconds2 = time (NULL);
>
>   } while(seconds2 - seconds1 <= 600); // max time in seconds
>
> I came up with it this morning and it seems to do the job. The
> solution is to check the time after every key press.

Going by the code you have here, I am guessing you are using Turbo C++?

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to