January 10, 2003 Counting lines in a file | ||||
---|---|---|---|---|
| ||||
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 |
January 11, 2003 Re: Counting lines in a file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrew Edwards | 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 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 > > |
Copyright © 1999-2021 by the D Language Foundation