Phillip Mills <ph************@acmDELETE.org> wrote in message news:<41********@127.0.0.1>...
[ ... ]
That's simply not true -- Windows does nothing of the sort.
Actually it is *simply* true -- in other words, true for practical
purposes. It only becomes questionable when you complicate it with
unnecessary pedantry.
No -- not true for practical, or any other, purposes. You might be
able to argue that it was true for practical purposes if it was
required that every possible implementation of C++ for Windows acted
the same way -- but that's not the case, and in fact there are C++
compilers available for Windows that do NOT do such a translation. As
such, it's an important distinction because if the OP used a different
compiler on Windows, he'd find different behavior. If he believe that
it was Windows itself that caused the behavior in the first place,
this would lead to still greater confusion.
The translation is done by the C runtime library,
You're just specifying which part of the Windows system is being
annoying, not actually contradicting anything.
Perhaps that's the case on your planet, but it certainly isn't true
here on planet earth.
and it happens
because you've _asked_ it to,
No, it happens without being "asked" anything of the sort. It
__defaults__ to writing more bytes than it was told to and more bytes
than it does on other systems under the same conditions. If the OP had
been required to ask for that behavior, he would probably not have
joined the legions who have stumbled on it over the years.
Quite the contrary -- the C standard specifies that translated mode is
the default, yes. That means that when you don't specify ios::binary,
you're _asking_ it to do whatever translation is needed to conform to
the local "customs" for a text file.
The fact that you've asked for this behavior tacitly doesn't change
the fact that you have asked for it. If the OP intends to learn to
program in C++, he needs to learn what parameters mean what when
calling standard library functions. Trying to teach him nonsense and
then claiming that it's true for practical purposes is NOT doing him
any favor.
not because it "thinks it's smarter than
you are". I'd also note that Windows is hardly alone in defining text
mode such that translated mode really involves doing a translation.
Right.... DOS, too.
This makes you sound narrow-minded and ignorant. In addition to the
DOS, OS/2, Windows family, MacOS, VMS, z/OS, etc. require translation
of text files. On MacOS the translation is different from on Windows,
but about equally trivial. On VMS, z/OS, and a whole host of older IBM
mainframe OSes, the translations involved are decidedly less trivial,
to put it mildly.
--
Later,
Jerry.
The universe is a figment of its own imagination.