Why does readln include the line terminator?

Sean Kelly sean at invisibleduck.org
Tue Apr 14 11:32:27 PDT 2009


Steven Schveighoffer wrote:
> On Tue, 14 Apr 2009 13:19:49 -0400, Andrei Alexandrescu 
> <SeeWebsiteForEmail at erdani.org> wrote:
> 
>> Georg Wrede wrote:
>>> In 25 years of computing, I have yet to see a file where variation of 
>>> line termintators in the file contained some /deliberate/ information.
>>
>> 25 years and no networking code?
> 
> Been writing code for about 12 years, lots and lots of networking code.  
> Still have never seen this.  Don't see your point either.

With HTTP, for example, lines are terminated with \r\n.  The lines 
themselves (in the header, at least) have constraints on the character 
range they allow, so one might want to error on solo \n but break on a 
\r\n, etc.  Still, I don't know why anyone would use readln() for 
processing a network protocol, so perhaps the issue is moot.



More information about the Digitalmars-d mailing list