R
rafal_
Is difference between interpretation of \n only difference ?
Is difference between interpretation of \n only difference ?
Difference in what?
Oh, I see... You put some critical information in the subject
and failed to include it in the body of your message. The
relevent information is "text files".
So, I assume your question is "are there any differences between
text mode and binary mode, other than '\n' interpretation?"
Is difference between interpretation of \n only difference ?
No. Text files often have a control Z as end of file marker. However on mostIs difference between interpretation of \n only difference ?
[ ... ]No. Text files often have a control Z as end of file marker.
No. Text files often have a control Z as end of file marker. However on
most systems the text and binary formats are in fact identical.#
Flash Gordon said:Malcolm McLean wrote, On 19/07/07 20:59:
So you think most systems are not DOS/Windows/VMS/MacOS-9/whatever?
I'm sure at least one other OS I know has a different format for text
files to binary files, but I'll stick to the ones where I know there
are differences. Also, remember that Windows probably includes WinCE
and its successors which are used in some PDAs and mobile phones.
What exactly does "binary format" mean? On many (most?) systems,
there's no such thing as a "binary format" -- or rather, there's a
practically infinite number of such formats, at least potentially.
A text file is (usually) just a special case of a binary file, with
some structure imposed on it.
Now it would make sense to ask what translations are performed when
access a file in text mode as opposed to binary mode, but I'm not sure
whether that's what the OP asked.
Malcolm McLean said:No. Text files often have a control Z as end of file marker. However
on most systems the text and binary formats are in fact identical.#
Richard said:What on earth is "binary format"?
A catch-all name, I presume, for all human-unreadable
information.
Malcolm McLean said:No. Text files often have a control Z as end of file marker. However on
most systems the text and binary formats are in fact identical.#
osmium said:The most common form of text files use ASCII code, and there is
no character
called 'control Z' in ASCII.
Furthermore, I don't know of any
compiler for desktop computers that expects EOF to be encoded
in the data, EOF is a
*condition* detected by the OS. One can signal EOF from a
keyboard by pressing the key combination ctrl + 'z', usually
written as ^Z, on a DOS
based machine. I think that is what is referred to above, but
it has
nothing to do with files. Files are an *external*
representation of a data set, a keyboard is not an external
representation.
osmium said:The most common form of text files use ASCII code, and there is no character
called 'control Z' in ASCII. Furthermore, I don't know of any compiler for
desktop computers that expects EOF to be encoded in the data, EOF is a
*condition* detected by the OS.
The most common form of text files use ASCII code, and there is no character
called 'control Z' in ASCII. Furthermore, I don't know of any compiler for
desktop computers that expects EOF to be encoded in the data, EOF is a
*condition* detected by the OS. One can signal EOF from a keyboard by
pressing the key combination ctrl + 'z', usually written as ^Z, on a DOS
based machine. I think that is what is referred to above, but it has
nothing to do with files. Files are an *external* representation of a data
set, a keyboard is not an external representation.
yes but http://en.wikipedia.org/wiki/ASCII at least mentions
control character encodings for some of the values.
So 0x1a is actually the "substitute" character rather than ^Z?
osmium said:The most common form of text files use ASCII code, and there is no character
called 'control Z' in ASCII. Furthermore, I don't know of any compiler for
desktop computers that expects EOF to be encoded in the data, EOF is a
*condition* detected by the OS.
[Off-Topic] CP/M used a 0x1A character (a.k.a "Control-Z") as an EOF
marker "encoded in the data", since the OS kept track of file sizes
only as multiples of 128 byte blocks. (This convention was used only
in text files, obviously.)
Since every CP/M program that manipulated text expected this, and
Microsoft's DOS started its life as a CP/M look alike for the 8086/8
family, DOS programs also interpreted (and many still do) a CTRL-Z as
an EOF mark, and added automatically a CTRL-Z at the end of text files
when closing them. [...]
I was forced to do the same eons ago, when writing C programs that had
to be portable between MSDOS, CP/M and DEC's operating systems.
Peter J. Holzer said:When I wrote C programs for MS-DOS (eons ago), the stdio libraries of
the compilers I used at the time (Borland and Microsoft) did that [deleting control-Z]
automatically if a file was opened in text mode.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.