The get procedure reads the next component from a file into the file's buffer variable. NOTE: This procedure is seldom used since it is usually easier to use the read or readln procedures.
The get procedure's only parameter is a reference to the file variable associated with the file to be read. The file variable must be open before calling this function.
//********************************************************
//This program is similar to the unix shell command "cat".
//It uses the built-in procedures "get" and "put" as well
// as the file buffer's associated with the input and
// output file to copy the contents of the input file to
// the output file.
program cat(f, g);
var
f, g : text;
c : char;
begin
reset(f);
rewrite(g);
while not eof(f) do
begin
c := f^;
get(f);
g^ := c;
put(g);
end;
close(g);
close(f);
end.
Operating Systems: All
Standard Pascal: Yes