how to get line number after readln

2014-06-04 Thread Robert Hathaway via Digitalmars-d-learn
I've got a program that reads a text file line by line (using std.stdio readln()) and I'd like to refer to the line number when I send a message to stderr upon finding a mis-formatted line. Is there a way to get the current line number? Of course, I could create a counter and increment it

Re: how to get line number after readln

2014-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 06/04/2014 05:05 PM, Robert Hathaway wrote: I've got a program that reads a text file line by line (using std.stdio readln()) Consider using byLine() instead. (Important: byLine uses an internal buffer for the line; so, don't forget to make a copy if you want to store the line for later

Re: how to get line number after readln

2014-06-04 Thread Brad Anderson via Digitalmars-d-learn
On Thursday, 5 June 2014 at 00:33:26 UTC, Ali Çehreli wrote: On 06/04/2014 05:05 PM, Robert Hathaway wrote: I've got a program that reads a text file line by line (using std.stdio readln()) Consider using byLine() instead. (Important: byLine uses an internal buffer for the line; so, don't