[Mark]
I asked Guido to provide comments on one of the chapters in our book:
I was discussing appending the mode ("t" or "b") to the open() call
[Guido]
p.10, bottom: text mode is the default -- I've never seen the 't' option described! (So even if it exists, better be silent about it.) You need to append 'b' to get binary mode instead.
I hadn't either, until I made the mistake of helping Mr took-6-exchanges-before-he-used-the-right-DLL Embedder, who used it in his code. Certainly not mentioned in man fopen on my Linux box.
This brings up an interesting issue.
MSVC exposes a global variable that contains the default mode - ie, you can change the default to binary. (_fmode for those with the docs)
Mentally prepend another underscore. This is something for that other p-language.
... The case for abandoning the CRTL's text mode gets stronger and stronger!
If you're tying this in with Tim's Icon worship, note that in these days of LANS, the issue is yet more complex. It would be dandy if I could read text any old text file and have it look sane, but I may be writing it to a different machine without any way of knowing that. When I bother to manipulate these things, I usually choose to use *nix style text files. But I don't deal with Macs, and the only common Windows tool that can't deal with plain \n is Notepad. and-stripcr.py-is-everywhere-available-on-my-Linux-box-ly y'rs - Gordon