Re: Am I misusing with?

2019-01-19 Thread Q. Schroll via Digitalmars-d-learn
On Saturday, 19 January 2019 at 20:38:00 UTC, faissaloo wrote: On Saturday, 19 January 2019 at 20:07:34 UTC, Rubn wrote: On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: [...] If you look at the implementation, "lines" is a struct.

Re: Am I misusing with?

2019-01-19 Thread faissaloo via Digitalmars-d-learn
On Saturday, 19 January 2019 at 20:07:34 UTC, Rubn wrote: On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: [...] If you look at the implementation, "lines" is a struct. https://github.com/dlang/phobos/blob/v2.084.0/std/stdio.d#L4330 [...] Ah that makes some sense, thanks for

Re: Am I misusing with?

2019-01-19 Thread Rubn via Digitalmars-d-learn
On Saturday, 19 January 2019 at 17:49:31 UTC, faissaloo wrote: This seems to work fine file = File("test.txt", "r"); with (file) { scope(exit) close(); foreach (string line; file.lines()) { line_array ~= line; } } however: file =

Am I misusing with?

2019-01-19 Thread faissaloo via Digitalmars-d-learn
This seems to work fine file = File("test.txt", "r"); with (file) { scope(exit) close(); foreach (string line; file.lines()) { line_array ~= line; } } however: file = File("test.txt", "r"); with (file) { scope(exit) close();