HP SunSoft Pascal 4.0 Manuale Utente Pagina 36

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la 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 }
Vedere la pagina 35
1 2 ... 31 32 33 34 35 36 37 38 39 40 41 ... 332 333

Commenti su questo manuale

Nessun commento