program DataFiles;
var
f:
file of Byte;
begin
end.
===
program DataFiles;
var
f:
file of Byte;
begin
Assign(f,'MyFile.dat');
end.
===
program DataFiles;
var
f:
file of Byte;
begin
Assign(f,'MyFile.dat');
Rewrite(f);
end.
====
program DataFiles;
var
f:
file of Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
end.
====
program DataFiles;
var
f:
file of Byte;
b:
Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
b
:= 1;
Seek(f,0);
Write(f,b);
end.
=====
program DataFiles;
var
f:
file of Byte;
b:
Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
Seek(f,0);
Read(f,b);
end.
=====
program DataFiles;
var
f:
file of Byte;
b:
Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
Seek(f,0);
Read(f,b);
Close(f);
end.
======
program DataFiles;
var
f:
file of Byte;
b:
Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
while
FilePos(f) <> FileSize(f) do
begin
Read(f,b);
Writeln(b);
end;
Close(f);
end.
=====
program DataFiles;
var
f:
file of Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
Seek(f,3);
Truncate(f);
Close(f);
end.
===
program DataFiles;
var
f:
file of Byte;
begin
Assign(f,'MyFile.dat');
Reset(f);
Seek(f,3);
Truncate(f);
Close(f);
end.
====
program DataFiles;
type
StudentRecord
= Record
Number:
Integer;
Name:
String;
end;
var
Student:
StudentRecord;
f:
file of StudentRecord;
begin
Assign(f,'MyFile.dat');
Rewrite(f);
Student.Number
:= 12345;
Student.Name
:= 'John Smith';
Write(f,Student);
Close(f);
end.
Tidak ada komentar:
Posting Komentar