lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remo Dentato wrote:
[...]
> I guess that the read function in the gcc C library interprets 0x1A (CTRL-Z) as 
> EOF.

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.

- --
┌── dg@cowlark.com ─── 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

iD8DBQFGoTeuf9E0noFvlzgRAjtAAJ45JUH0EoDespe6HAdn9FP51Az9WQCeOUB4
GAOoGsHLC43MspoYlrbcMT0=
=MX1O
-----END PGP SIGNATURE-----