[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: Andrew Makhorin
Subject: [Help-glpk] Re: LF vs CRLF in csv files
Date: Mon, 18 Feb 2008 10:43:40 +0300

> 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".

(Please do not cc your messages to <address@hidden>. That mailing
list is used only for announcements of GNU software.)

reply via email to

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