Input and Output Redirection

How can I get my program to take input from a file rather than me typing it in? How can I get it to send output to a file rather than the screen?

Redirecting input and output

To tell a program myprog, which lives in the current directory, to get its input from a file input.txt, use

torbernite% ./myprog < input.txt

To send normal output (e.g, the results of print statements) to output.txt, use

IT Courses and Training

Within the Mathematical Institute

  • There is a large amount of online documentation and answers to questions on the Mathematical Institute help web pages.
  • Books and manuals are available in the Whitehead Library in the St Giles Building and the Alan Tayler Room in Dartington House
  • The computing officers are also available to give one to one assistance as required wherever possible.


Within LaTeX

To enable cyrillic within LaTeX add the lines


to the preamble in your LaTeX document. Then the command \textcyr will produce cyrillic text, e.g. \textcyr{a}.


WV (formerly called wordview) provides a set of commands for converting Microsoft Word Documents to other formats.

NOTE: WV is still a developing package and may not handle figures correctly in all case. It is unlikely to handle equations at all.


Subscribe to Mathematical Institute RSS