mintz@hpindda.HP.COM (Ken Mintz) (05/09/88)
While doing my 1st DOS program in many years, I may have stumbled onto 2 defects. Can someone confirm my observations and perhaps tell me if these have since been fixed in updates? (My versions are VERY old.) (1) It appears that DOS (or the Lattice C library) echos stdin to stdout, even if they're both redirected. In my case, stdin was redirected from a disk file, and stdout was redirected to the printer. Is there a straight-forward way to avoid this? I worked around it by opening the disk file explicitly, but I prefer to write filters which can operate on either stdin or a disk file. (2) It appears that the "b" option of fopen() in the Lattice C library does not work, or at least is ignored by putc(). When I give putc() a \012 (LF), it appears to be translated to a \015 (CR). (My file was lpt1:.) This problem is not apparent if I open() the file with O_RAW and use write(). By the way, does anyone know what the Lattice C library (or DOS) wants to see from the keyboard for EOF? ^D doesn't do it. A pointer to where this is documented would be appreciated. Thanks in advance. Ken Mintz
dalegass@dalcsug.UUCP (Dale Gass) (05/11/88)
In article <4330078@hpindda.HP.COM> mintz@hpindda.HP.COM (Ken Mintz) writes: >While doing my 1st DOS program in many years, I may have stumbled onto 2 >defects. We've discovered a code generation bug in lattice C (ver 3.0)... When initializing elements in a structure entry as follows: data[index].item1 = t1 * 100.0; data[index].item2 = t2 * 100.0; Lattice tries to be smart, and stashes index away in [bp+0] and [bp+2] temporarily, but when it goes to pick it up to use it for the second line, it picks it up in *reverse* order (so if the index was 0x100, it becomes 0x1000000, even though index is only an int [it is stashed and handled as a long for a long multiplication for the indexing into array of structure]). Kinda scary working with a compiler that pulls something like this; makes you wonder what else it's doing. -dalegass@dalcsug.uucp
mintz@hpccc.HP.COM (Ken Mintz) (05/25/88)
I wrote previously: > By the way, does anyone know what the Lattice C library (or DOS) wants to > see from the keyboard for EOF? A number of people have written to say that ^Z is the DOS end-of-file character. Thanks again for the feedback. Ken Mintz