To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 14520
14519  |  14521
Subject: 
Re: how does a line end?
Newsgroups: 
lugnet.cad
Date: 
Sat, 7 Apr 2007 17:38:25 GMT
Viewed: 
5245 times
  
In lugnet.cad, Chris Phillips wrote:
> In lugnet.cad, Tore Eriksson wrote:
> > 2. As I always use \n, I don't know the output of the other alternatives. \n
> > gives the sequence "\13\10", or "0x0C 0x0A" in hexadecimals from Borland
> > TC++ v3.0.
> 
> Slight correction - "[0x0D] 0x0A"


Aaah, that's one of my most common mistakes. C is the third letter, so I think
of it as 13 and not 12.


> > There was a Swedish finance minister that said it's safer to have both a
> > belt and suspenders. I think the optimal fool-proof way to go is to make
> > software as liberal as possible when it comes to input, but conservative on
> > output. Make it able to read Mac's special LF but write strictly CR+LF.
> 
> Agreed 100%

At last, someone agrees with me. :)

There will still be a theoretical risk that problems will occur, "anything that
can go wrong will go wrong", but at least we've done what we can to minimize it.


/Tore



Message is in Reply To:
  Re: how does a line end?
 
(...) Slight correction - "0x0D 0x0A" And this is kind of my point. The string you pass to printf() has \n only, which is only one byte. Offhand I don't remember if this is because of the Borland libraries, the operating system, or the fact that (...) (19 years ago, 7-Apr-07, to lugnet.cad, FTX)

24 Messages in This Thread:











Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR