6
votes
2answers
302 views

\read: trailing spaces are removed

I'm trying to copy a (binary) file with LaTeX (mostly for the sake of it), but when I read a line, the trailing spaces are removed. The MWE, based on this TeX.SX answer: \edef\infile{infile} ...
9
votes
1answer
150 views

Can TeX detect a newline at the end of the file?

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 ...
5
votes
1answer
117 views

Read manuscript in to output

I want to put my source plain TeX file in the output of the same plain TeX file. As I remember coming through a macro, that can put a file's content in to the output, but only \input comes to mind. ...
5
votes
2answers
479 views

Open a file whose name start with a dot and other strangely named files?

The syntax of TeX's \openout command is rather simple: \openoutN=filename where N is a four-bit number, but what is filename? How do you open a file whose name stars with a dot? More generally, how ...
8
votes
2answers
410 views

Checking whether a file is empty?

Well, the obvious way to do that is with \ifeof, but for some reason, I cannot do this right. I wrote \newread\reader \openin\reader=empty \relax \ifeof\reader\message{empty}\else\message{not ...
13
votes
3answers
881 views

How can I open a file in “append” mode?

Could not find anything in the TeXBook, but this could be just me. I guess it is always possible to open the file for reading, copy its content to another file, and then continue writing to that ...
14
votes
4answers
673 views

File copy without expansion

What is the command for file copy? I want to copy the contents of one file into another without any command expansion. The operative system would use copy source target I tried reading the contents ...