Re: end of line handling under NT

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Sat Jan 22 2000 - 01:13:10 MET


> 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