Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 07:38:04 UTC, Mike Parker wrote: On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost pe

Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost peice of data. This does have an odd consequence though, if you p

Re: Big Oversight with readln?

2017-02-23 Thread Jonathan Marler via Digitalmars-d-learn
On Friday, 24 February 2017 at 03:45:35 UTC, Nick Sabalausky (Abscissa) wrote: On 02/23/2017 09:43 PM, Jonathan Marler wrote: I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from

Re: Big Oversight with readln?

2017-02-23 Thread Nick Sabalausky (Abscissa) via Digitalmars-d-learn
On 02/23/2017 09:43 PM, Jonathan Marler wrote: I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from $(D stdin) and count words void main() { char[] buf;

Big Oversight with readln?

2017-02-23 Thread Jonathan Marler via Digitalmars-d-learn
I can't figure out how to make use of the full capacity of buffers that are allocated by readln. Take the example code from the documentation: // Read lines from $(D stdin) and count words void main() { char[] buf; size_t words = 0; while (!stdin.eof)