program Files;
var
f:
Text;
begin
end.
===
program Files;
var
f:
Text;
begin
Assign(f,'MyFile.txt');
end.
===
program Files;
var
f:
Text;
begin
Assign(f,'MyFile.txt');
Rewrite(f);
end.
===
program Files;
var
f:
Text;
begin
Assign(f,'MyFile.txt');
Rewrite(f);
Writeln(f,'A
line of text');
end.
===
program Files;
var
f:
Text;
s:
String;
begin
Assign(f,'MyFile.txt');
Reset(f);
while
not eof(f) do
Readln(f,s);
end.
===
program Files;
var
f:
Text;
s:
String;
begin
Assign(f,'MyFile.txt');
Append(f);
Writeln(f,'Some
more text');
end.
===
program Files;
var
f:
Text;
s:
String;
begin
Assign(f,'MyFile.txt');
Append(f);
Writeln(f,'Some
more text');
Close(f);
end.
===
program Files;
var
f:
Text;
begin
Assign(f,'MyFile.txt');
Rename(f,'YourFile.txt');
Erase(f);
Close(f);
end.
===
program Files;
var
f:
Text;
IOR:
Integer;
begin
Assign(f,'MyFile.txt');
{$I-}
Reset(f);
{$I+}
IOR
:= IOResult;
if
IOR = 2 then
Writeln('File
not found');
else
if
IOR <> 0 then
Halt;
Close(f);
end.
Tidak ada komentar:
Posting Komentar