Delay function?

Brendan brenzie at gmail.com
Tue Sep 2 14:08:36 PDT 2008


Denis Koroskin Wrote:

> Google for "buffering". When you print something, it doesn't get displayed  
> immediately. Instead, the string is copied to some internal buffer and  
> when it gets full (or close to full) it is then flushed, i.e. its contents  
> copied to the console and buffer size reset. Something like this:
> 
> char[] buffer;
> 
> void writefln(char[] str)
> {
>    buffer ~= str;
>    if (buffer.length > 1024) {
>      doTheRealPrinting(buffer);
>      buffer.length = 0;
>    }
> }

Ahhh, a buffer!

So basically, in the correct piece of code (the scroll function) a few messages back, in the for loop, the buffer is constantly unloading the characters from itself? It is so beautiful. Thanks :)


More information about the Digitalmars-d-learn mailing list