Negating \ifeof
It depends a bit what you mean by plain TeX.
As cmhughes just mentioned in comments you could use the e-TeX unless
command to negate the expression or you could copy the LaTeX definition of \loop
which would allow you to do
\openin0=MyFile
\loop
\read0to\linein
\linein
\ifeof0 % Fails here
\else
\repeat
so that you could work with an unextended TeX.
The plain \loop
is
\def\loop#1\repeat{\def\body{#1}\iterate}
\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next}
\let\repeat=\fi
LaTeX uses the following definition so \else
works.
\def\loop#1\repeat{\def\iterate{#1\relax\expandafter\iterate\fi}%
\iterate \let\iterate\relax}
\let\repeat\fi
If you like theory, here is David Kastrup’s \ifnot
macro:
\def\ifnot#1{#1\else\expandafter\expandafter\fi\iffalse\iftrue\fi}
This can be used as
\loop ... \ifnot{\ifeof\stream} ... \repeat
See Victor Eijkhout, TUGBoat.