Berikut adalah contoh program 'file' pada pascal:
1. Hasil program pada pascal
2. jika dibuka dalam bentuk .txt
Source Codenya:
program
file_;
uses
Crt;
var tes : text;
nama,nim
: string;
no,shift,pilih,i
: byte;
tanya
: char;
begin
clrscr;
Assign(tes,'file.txt');
rewrite(tes);
Repeat
inc(i);
writeln('
=====================================');
writeln(' Data - ',i);
writeln('
-------------------------------------');
write(' Nama : '); readln(nama); writeln(tes,nama);
write(' NIM : '); readln(nim); writeln(tes,nim);
write(' Shift : '); readln(shift);writeln(tes,shift);
write(' No. Meja : '); readln(no); writeln(tes,no);
writeln('
-------------------------------------');
writeln(tes,' ');
Write(' Memasukan Lagi (Y/T) : ');
readln(tanya);
writeln('
=====================================');
writeln;
Until UpCase(tanya) = 'T';
Close(tes);
writeln('Silahkan buka file dengan nama
"file.txt" ');
readkey;
end.