On Monday, 18 May 2015 at 16:40:30 UTC, Dennis Ritchie wrote:
On Monday, 18 May 2015 at 12:49:56 UTC, Kagamin wrote:
Filling a buffer is usually done this way:
http://dlang.org/phobos/std_stdio.html#.File.rawRead
Here such example, the task. There is a flow stream,
associated, for example, with any socket. It wrote several
bytes at a time. To once again not to pull the socket, we start
buffer as an array with Phill-pointer. Adding byte array -
using the vector-push. When the buffer is stuffed, dump it into
the stream and moves pointer to zero. How to do it with the
help of readRaw or there writeRaw?
If you want to implement a buffered output stream, it's done
manually like this:
https://github.com/D-Programming-Language/phobos/blob/master/std/stream.d#L1711
or this:
https://github.com/schveiguy/phobos/blob/new-io3/std/io/text.d#L665