Is TeX able to distinguish beween a file containing, say, the single character a
/ byte 97; and a file containing this same character followed by a newline marker (which is system-dependent)?
I had a bit of trouble creating a file with no trailing newline, so in case you need it, here is one way:
luatex "\directlua{io.output('test1.txt'):write('a') io.output('test2.txt'):write('a\string\n')}\bye"
Can TeX distinguish test1.txt
from test2.txt
(besides their name)? It seems that \read
and \readline
both discard a trailing newline and set \ifeof
to true at the same time regardless of the presence of a trailing newline.