D - Counting lines in a file
- Andrew Edwards (8/8) Jan 10 2003 While playing with the wc2.d example I noticed that when d accesses a fi...
- Walter (4/12) Jan 11 2003 I'll check it out. -Walter
While playing with the wc2.d example I noticed that when d accesses a file it counts the first line as 0. Therefore if there is 10 line in the file it will say there are only 9. This requires that we add an extra "empty" line to your files in order to get an accurate count. I'm thinking that the reason for this is that D uses the CR character to identify the end of line. Could we not use both CR & EOF? This would eliminate the need for that extra line. Minor but wbn. Thoughts? Andrew
Jan 10 2003
I'll check it out. -Walter "Andrew Edwards" <aedwards spamfreeamerica.com> wrote in message news:avnjnl$rep$1 digitaldaemon.com...While playing with the wc2.d example I noticed that when d accesses a file it counts the first line as 0. Therefore if there is 10 line in the fileitwill say there are only 9. This requires that we add an extra "empty" line to your files in order to get an accurate count. I'm thinking that the reason for this is that D uses the CR character to identify the end of line. Could we not use both CR & EOF? This would eliminate the need for that extra line. Minor but wbn. Thoughts? Andrew
Jan 11 2003