Re: [xml] Nano HTTP: Text vs Binary (unportable code)



On Tue, Apr 13, 2004 at 02:56:01PM +0200, Tanguy Fautré wrote:
1) Unportable UNIX system calls are used for handling files. Why not use FILE* 
which is the portable way to handle files in C?

  Because Solaris was breaking due to a limited of FILE * allowed per process.

2) As the symptoms suggest, the file is opened in default mode, which is text 
mode.
Notice that under Linux there isn't really such a thing as a text mode, 
because it's the same as the binary mode; which is why you can't specify 
O_BINARY in open() under Linux (I don't see it in the man page, but I could 
be wrong).
But under Windows, it's not the same and some characters get modified (ex: 
'\n' becomes LineFeed + CarriageReturn, or something like that).

  I though those portability problems had been solved years ago ...

So, shouldn't files be always saved in binary?

  In the context of XML, yes I think so.
Concerning your example, it's C++, using the C++ I/O, I fail to see how this
relates to libxml2.

Daniel

P.S.: for further discussion, please subscribe to the list.

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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