On Sunday 12 September 2010 18:04:14 Andrej Mitrovic wrote: > Here's a little snippet of code that interfaces with Scintilla (it works > btw.): > > File file = File("test.txt", "r"); > foreach (ubyte[] buf; file.byChunk(4096)) > { > sendEditor(SCI_ADDTEXT, buf.length, (cast(char[])buf).idup); > } > > The cast looks ugly, but I *have* to send a copy. Am I doing it right, or > can I make this a bit simpler? Otherwise I can use file.byLine, but I > think this would be much slower (unless D reads the entire contents at > once into memory, but I think it does not).
I'd have to check, but I believe that byLine() reads the whole line into memory but not the whole file. - Jonathan M Davis