Re: [CODE] Ascii pfiles and autowiz

From: Mike Breuer (mbreuer@new.rr.com)
Date: 06/21/01


----- Original Message -----
From: "Daniel A. Koepke" <dkoepke@CIRCLEMUD.ORG>
Sent: Thursday, June 21, 2001 1:38 PM


> For Windows users, I suspect this means, but have never personally tested,
> that writing "hello\n" with the mode "w" and reading it back with the mode
> "rb" and a function like, say, get_line() would give you "hello\r".
> Which might be quite confusing... And maybe even undesirable.

When writing with "w" mode, Windows expands \n to mean \r\n.  When reading in
"r" mode, Windows translates \r\n to \n.  In "rb", you will read exactly
what's in the file, which is "hello\r\n" in your example.

I think we are all in agreement on this, but to clarify: as a rule, you should
always read in the same way that you write to avoid undesired behavior.  Since
Circle is cross-platform, it would make the most sense to always use "b"
modes, since that would allow the files to be moved across platforms without
running into translation problems (unless of course you use ftp in ascii mode
to transfer them :) ).

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST