Worse, on many
systems the answer differs depending what point you
measure at. On most Unix variants, for example, [a line break is]
0x0a when measured in files or in C strings, but 0x0d 0x0a when
measured on hardware serial lines.
in which case, what characters would
fprintf(PRN, "%s" , "X\n" );
actually send to the printer?
"It depends" - which was really my point. It could send 0x58 0x0a, or
it could send 0x58 0x0a 0x0d, or possibly even other things under more
unusual circumstances. Even serial lines can on most systems be put
into a mode wherein they're content-blind octet streams, in which case
mapping between '\n' and CRLF doesn't happen.
Of course, the printier may well be a parallel instead of serial
interface, in which case it's even more of a crapshoot what you get.
Parallel interfaces usually are treated differently from serial
interfaces, and mapping '\n' to CRLF is one of the things that
plausibly may differ.
But it still depends on where you measure. It's plausible, for
example, that it's two octets at the syscall interface but three at the
hardware interface, each of which is a reasonable interpretation of
"actually send to the printer" in an appropriate context.
in which case, HOW MANY characters would
fprintf(PRN, "%s" , "X\n" );
actually send to the printer?
See above - usually either two or three, depending on whether
'\n'->CRLF mapping is being done.
Then in what
sense are those choices "wrong"?
so, may I assume that you have no
objection to Tandy defining NEWLINE
as 0Dh?
Within the context of their systems? Only that it hampers
interoperability, both mechanized and human, but that's not enough for
me to call it "wrong" in isolation from a context.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B