You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Yuri V. Vishnevskiy" <yu...@gmail.com> on 2009/09/10 11:37:47 UTC

Newline chars in Win and OS/2

Dear All,
is this correct behaviour of the apr_file_puts function which prints a  
"bla-bla-bla \n" string to file _without_ conversion of the \n to \r\n  
sequence under Windows ans OS/2 ?

Regards,
Yura Vishnevskiy

Re: Newline chars in Win and OS/2

Posted by "Yuri V. Vishnevskiy" <yu...@gmail.com>.
>> is this correct behaviour of the apr_file_puts function which prints a
>> "bla-bla-bla \n" string to file _without_ conversion of the \n to \r\n
>> sequence under Windows ans OS/2 ?
>>
> If the file is opened in text mode, not binary mode, then the o/s library
> should be handling the newline to CRLF conversion automatically.
>
> If that doesn't happen, then (1) is the file opened in binary mode and  
> (2)
> does that mean APR has to deal with aberrant implementations of the C
> standard I/O library on basic functionality?

No, I do not use APR_BINARY here.

Besides, APR_BINARY does not influence anything as can be seen from the  
code.

As I understand, in APR there is only one binary mode.

Then I do not understand why apr_file_open_std* and  
apr_file_open_flags_std* functions are implemented in APR. Because the  
corresponding streams should work in text mode only, which is not the case  
in Windows and OS/2. On the other hand I need these functions since I use  
poll functions with std* streams.

Best wishes,
Yura Vishnevskiy

Re: Newline chars in Win and OS/2

Posted by Jonathan Leffler <jo...@gmail.com>.
On Thu, Sep 10, 2009 at 2:37 AM, Yuri V. Vishnevskiy <
yuri.vishnevskiy@gmail.com> wrote:

> is this correct behaviour of the apr_file_puts function which prints a
> "bla-bla-bla \n" string to file _without_ conversion of the \n to \r\n
> sequence under Windows ans OS/2 ?
>

If the file is opened in text mode, not binary mode, then the o/s library
should be handling the newline to CRLF conversion automatically.

If that doesn't happen, then (1) is the file opened in binary mode and (2)
does that mean APR has to deal with aberrant implementations of the C
standard I/O library on basic functionality?

-- 
Jonathan Leffler <jo...@gmail.com>  #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."