RE:Re: end of line handling under NT

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sun Jan 23 2000 - 22:23:25 MET


Hello Stephan and Valery,

I think this depends on whether you open the file with

    FILE* fp = fopen("fname","rb");

 or

    FILE* fp = fopen("fname","r");

The first case opens the file with binary mode and second text mode.

If you open the file by yourself, it is under your control to choose
between binary and text mode. As long as you use fopen(), Cint simply
behaves the same as the compiled code. 

If the file is opened by ROOT or CINT utility, it is likely the mode 
is binary. I think this is unlikely, but this case, we may need to 
modify things in ROOT or CINT.

Thank you
Masaharu Goto



>
>> Hello,
>> 
>> I'm using ROOT v 2.23/09 on a PC with NT v4 (sp5). 
>> fgets is not acting as expected. I recognized this behaviour some time 
>> ago.
>> This function should read >1< line or MAX-1 characters from a file. 
>> Instead
>> it reads always MAX-1 characters including newlines (0x0d 0x0a).  
>> 
>
>  This sounds like CINT "defaults" are "UNIX" defaults. Namely,
>   CINT opens files in "binary" mode.
>   UNIX opens the file as  "binary" "by default,  "native" NT does 
>   the "text" default.
>
>  This means  to make code portable the user should always specify 
>  whether he wants the file to be open as "binary" or "text"
>  It is  true for the "plain" C/C++ environment as well (with no ROOT/CINT
>  involved).
>
>  From another hand one has to choose which text format he is going 
>  to play with "UNIX" / "NT".
>
>  Do you want to share the text files between UNIX and NT? It is question too
.
>  The ROOT assumption the files should be shared and by this reason they are
>   UNIX text files.
> 
>   Keep in mind:
>
>  - Usually few UNIX utilities can manage NT text files
>  - Usually any NT utility can "understand" the UNIX text format as well.
>
>  if decide to stick UNIX formsat then you have to make sure your favorite 
editor
>
>                can save the file in UNIX format (almost all of them can read
 
UNIX text 
>                but many of them write out  NT text format only (for example 
MS DevStudio
>
>
>> Do I have to switch to C++ streams?
>
>  Very likely there you face the same problem ?
>
>  May be Masa Goto can comment how  the default mode to open files 
> is chosen.
>
>   Valery
>



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET