Why does readln include the line terminator?

Stewart Gordon smjg_1998 at yahoo.com
Wed Apr 15 10:13:27 PDT 2009


Kagamin wrote:
> Stewart Gordon Wrote:
> 
>> Take these four cases:
>> (a) you want to process only files with a specific line ending style
>> (b) you want to know what line endings are used
>> (c) you don't care about what line endings are used, but still want to 
>> know whether or not the file ends with one
>> (d) you just want to read the file line by line, without caring about 
>> the line endings or the presence or absence of one at the end
>>
>> At the moment, readln is good only for (a).  readLine is good only for 
>> (d).  If you want (b) or (c), you'll have to come up with an alternative 
>> means.
> 
> I think, only (d) is important, all others are *strange* things. I 
> usually use ReadLine in conjunction with WriteLine.

So you expect text editors to discard both kinds of information?

I expect any text editor (don't get me started on Notepad) to do (c), 
and any decent text editor to be capable of (b).

Stewart.



More information about the Digitalmars-d mailing list