Re: [CODE] Ascii pfiles and autowiz

From: Daniel A. Koepke (
Date: 06/21/01

On Thu, 21 Jun 2001, Mike Breuer wrote:

> 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.

See my other message -- get_line() strips the trailing '\n'.  I don't
think a second \n will appear from the nether.  I might be wrong, though.

> Since Circle is cross-platform, it would make the most sense to always
> use "b" modes, [. . .]

Actually, since Circle is cross-platform, it would make the most sense to
open binary files with "b" modes and everything else without them.  The
problem with using "b" for everything is that you will then write files

  foo bar baz~\n
  a foo bar baz~\n

which, if edited with most Windows editors would give you the rather

  #1000foo bar baz~a foo bar baz~

or, maybe, stair-stepping like

       foo bar baz~
                   a foo bar baz~

The idea, of course, is for the ASCII files to be in the proper format for
editing on the platform that the administrator chooses to use.  If we
circumvent text-mode parsing, we're intentionally breaking this.

Naturally, there's some inconvenience implied when you're working with and
transferring files between multiple platforms with different line-endings.
You can get around this with any of the million of tools provided to do
the conversion or just FTP in ASCII mode.

Daniel A. Koepke (dak),
Caveat emptor: I say what I mean and mean what I say.  Listen well.
Caveat venditor: Say what you mean, mean what you say.  Say it well.

   | FAQ: |
   | Archives: |

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