[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Unexpected behaviour with %q formatted string
- From: David Given <dg@...>
- Date: Fri, 20 Jul 2007 23:31:10 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Remo Dentato wrote:
> I guess that the read function in the gcc C library interprets 0x1A (CTRL-Z) as
Yup; this is an ancient Windows/DOS problem, dating back from behaviour
inherited from CP/M, which only stored file sizes in disk blocks and needed a
mechanism for finding out where the end of a text file was.
You can turn this off if you open files with fopen(..., "rb") or "rb+". The
only operating system that needs the 'b' is DOS, so most people don't bother.
This will also prevent it from converting carriage returns into /r/n sequences.
┌── ｄｇ＠ｃｏｗｌａｒｋ．ｃｏｍ ─── http://www.cowlark.com ───────────────────
│ "There does not now, nor will there ever, exist a programming language in
│ which it is the least bit hard to write bad programs." --- Flon's Axiom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----