A good way is to use Rainer Schöpf's verbatim.sty,
which provides the command \verbatiminput
that takes a file name
as argument. This package is available as part of macros/latex/packages/tools
Another way is to use the alltt
environment, which requires
alltt.sty (which is now part of LaTeX).
The moreverb package (macros/latex/contrib/supported/moreverb) extends the
facilities of verbatim package), providing a listing
environment and a \listinginput
command, which line-number the text
of the file.