Mailinglist Archive: opensuse (3434 mails)

< Previous Next >
Re: [opensuse] amavisd warning failure?
  • From: "Carlos E. R." <robin.listas@xxxxxxxxxxxxxx>
  • Date: Mon, 18 Feb 2008 00:06:22 +0100 (CET)
  • Message-id: <alpine.LSU.1.00.0802172342120.6323@xxxxxxxxxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



The Sunday 2008-02-17 at 23:35 +0100, Anders Johansson wrote:

Actually, it is, because EOF is also an ascii character that indicates end
of file (for text files). I don't remember now is if is ^Z or ^D in linux,
though.

Well, it's ^D, but it's not an ascii character. It is defined as something
which can never be read from a file. All ascii characters can be read. There
is no character you can write to a file that will cause the file to stop
being read because of end-of-file.

There is an ascii character 0x03 (end of text) and 0x04 (end of message) but
those aren't the same as EOF

If you think about it, it's obvious: a binary file doesn't care about ascii
encodings. The 127 characters in ascii can occur anywhere in - for example -
a JPEG image. It would be disaster if that caused an end-of-file


One of the differences between text and binary files is that text files can contain control characters: new line, tabs... and an end of file marker. Yes, it is a character; not printable, not displayable, but a character all right. It is up to the application program to use it or not, and even to recognize it as EOF or something else.

I have had programs fail reading a file in the middle of it because they said they had found the EOF - in the middle!

I myself used this trick for my data files to be read by my programs in pascal (msdos). I wrote at the beginning of the file a small string describing the type of file and the program that used it, followed by the EOF char, and then the real binary data. When you run "type datafile" it printed that line(s) and stopped, without corrupting the screen.

- -- Cheers,
Carlos E. R.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)

iD8DBQFHuL3vtTMYHG2NR9URAg6uAJ9viBouAtJoNoWZc/5wPgdbI2stgACfcZ9R
QyLjhTWpC16cT1Y6PfeaSqc=
=aaW/
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >