[texhax] read file content as parameter until EOF?

Alexander Grahn A.Grahn at fz-rossendorf.de
Tue Jun 28 09:27:13 CEST 2005


Hi,

recently I get stuck with `whiledo' and `ifeof' and resorted to the low
level \loop ... \if ... \repeat structure.

Instead of testing for eof, I test the line read from file for doing
`nothing'. That is, if an empty line or a line containing whitespace
and/or `%'s is encountered, the loop is left and the file gets closed.

Alexander

\documentclass{article}

\def\formatparline#1;;#2;;#3;;{\noindent#1, #2, #3\\}

\def\createparlist{%
  \newread\parlistin%
  \openin\parlistin=participants.part%
  \loop%
    \read\parlistin to \temp%
  \if\temp\relax\else%
    \expandafter\formatparline\temp%
  \repeat%
  \closein\parlistin%
}

\begin{document}
  \createparlist
\end{document}



More information about the texhax mailing list