Input is a line at a time. freadint and freadstr read a line of input and return its value parsed as an integer or as a string respectively. Output using the functions fprintint and fprintstr need not be line at a time; line breaks occur only when the newline escape sequence \n is sent.
The function eof indicates whether end-of-file has been reached on an input file.
To illustrate this, here is a program reads a list of numbers from one file and prints their squares to another:
use(io). inp:var(tfile). outp:var(tfile). n:var(int). inp:=topenin("nums.dat"); outp:=topenout("new_nums.dat"); while (!eof(inp)) do ( n:=freadint(inp); fprintint(outp,n*n); fprintstr(outp,"\n") )