[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] Re: LF vs CRLF in csv files

From: glpk xypron
Subject: [Help-glpk] Re: LF vs CRLF in csv files
Date: Mon, 18 Feb 2008 20:54:14 +0100

Hello Andrew,

please, shouldn't opening the output file with mode "wb" solve the issue?

Best regards


-------- Original-Nachricht --------
> Datum: Mon, 18 Feb 2008 10:43:40 +0300
> Von: Andrew Makhorin <address@hidden>
> An: "glpk xypron" <address@hidden>
> CC: address@hidden
> Betreff: Re: LF vs CRLF in csv files

> > RFC 4180 explicitly defines that the line separator in CSV files is CRLF
> > (0x0d, 0x0a). Please, add the missing CR for table output.
> Thank you for the patch. Unfortunately, it leads to a portability
> problem. The point is that CSV is a text file, not binary, so according
> to the ISO C standard it should be fopen'ed (for writing) with mode "w",
> not "wb". And, how ISO C says (7.19.2 Streams), in this case:
>    Characters may have to be added, altered, or deleted on input and
>    output to conform to differing conventions for representing text in
>    the host environment. Thus, there need not be a one-to-one
>    correspondence between the characters in a stream and those in the
>    external representation.
> In particular, your patch works in the Unix and Linux host environment,
> but it will not work, say, in MS Windows, because, for example, MSVC
> replaces \n by \r\n on writing to a text file, so "aaa,bbb,ccc\r\n"
> would be written as "aaa,bbb,ccc\r\r\n".

Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]