HP SunSoft Pascal 4.0 Manual de usuario Pagina 36

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 333
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 35
12 Pascal 4.0 Users Guide
2
Using the same program, but with the < operator to redirect input, you can
print the file on the terminal:
Using a File Name as a File Variable
You can also redirect the output by listing the file as a file variable in the
program statement. The Pascal library associates the file variable with a file of
the same name. For example, copy2.p lists data as the input file variable:
hostname% copy < data
hello, are you listening?
goodbye, I must go now.
program copy2(data, output);
{ This program redirects input. }
var
c: char;
data: text;
begin
reset(data);
while not eof(data) do begin
while not eoln(data) do begin
read(data, c);
write(c)
end;
readln(data);
writeln
end
end. { copy2 }
Vista de pagina 35
1 2 ... 31 32 33 34 35 36 37 38 39 40 41 ... 332 333

Comentarios a estos manuales

Sin comentarios