H
Herbert Rosenau
<snip>
I think you are in violent agreement with me. I was responding to a
questions about why C has text streams as well as binary streams with an
explanation of the problems if it did not. You are explaining why C
programs see an abstraction (e.g. text and binary streams with the
system) specifics handled at a lower level.
Yes - but in question it helps nothing. Some years ago I had the job
to write a program that hat to read text files, reformat them from
line mode to stream mode (means having a paragraph as a sinlge line
independant how many single lines it were in the soure. Problem: the
files to convert on a single mashine were coming in native text
- origination from DOS/WIN, OS/2, FTP text \r\n
- origination from 370 FTP binary mode \n
- origination from 370 virtual console \r
All found mixed up in a single directory tree on local disk
Some of them were created with a stange program using 0x8d as soft
line feed.
Reading anything as text failed to get clean output.
So reading it in binary mode and interpreting
\r\n\r\n as paragraph separator
\r\r "
\n\n "
convert 0x8d to either nothing or single space
convert (\r)\n\f to \n\n
convert \f to nothing or single space
\t as single space - except in tables
\t as sequence of spaces in tables to fill up the columns
remove any syllable (mens make a single word of the syllabled one) but
leave hyphen intact
and then reformat to 80 column fixed font, leaving tables intact.
No problem insofar but the different newline separators had it made
impossible to read that as text because the only way to get out the
different text modes was to read that as binary stream.
myungetc(), mygetc() was needed to unget multiple chars.
--
Tschau/Bye
Herbert
Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!