readln with buffer fails

Peter Alexander via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 29 14:19:24 PDT 2014


You need to take a slice of the buffer:

char[] buf = Input[];
readln(buf);
// line now in buf

The reason for this is because you need to know where the string 
ends. If you just passed in Input, how would you know how long 
the line read was?


More information about the Digitalmars-d-learn mailing list