On 11/08/2023 10:22 pm, Mark Ogden wrote:
> Note, using fread / fwrite / fputs rather than fprintf/ printf, reduces the executable size by nearly 15% and should be quicker. It also preserves null characters from the input file.
I know little about C. My interest was prompted after finding Forth's READ-LINE
ran slowly under CP/M. I wanted to see how C compilers under CP/M performed.
Aztec C fgets proved to be 3x faster. I concluded it was due to the buffered I/O.
In contrast READ-LINE reads chunks at a time. If too much (most of the time) the
file pointer is shifted backwards for the next read. While not a problem under
MS-DOS, it's a performance killer under CP/M.
FWIW I noticed the Aztec C fgets/fprintf combo produced some unexpected results.
Unbeknown to me the source text file used included some 'foreign' characters
with bit 7 set. These did not pass through correctly e.g.
E2 80 99