Professional Documents
Culture Documents
Files c3
Files c3
Files c3
programming II
Sets
Record
Files (Text & Binary)
Pointers
Linked Lists
Unit
Two Types Of Files In Pascal:
1- Text Files
2- Binary Files
Concepts
human readable
editable (for instance by notepad++)
ASCII characters
has lines
Concepts in Pascal:
Sequential (SE)
Redirect standard input/output
open before / close after
read OR write
write = override
A text file (sometimes spelled "textfile": an old alternate name is "flatfile") is a
kind of computer file that is structured as a sequence of lines of electronic text. A
text file exists within a computer file system. The end of a text file is often denoted
by placing one or more special characters, known as an end-of-file marker, after
the last line in a text file.
"Text file" refers to a type of container, while plain text refers to a type of content.
Text files can contain plain text, but they are not limited to such.
from www.wikipedia.com
• We have to open the file when we use it , and
close it when we finish of using it .
• We open the file either to read from it or to write
in it , but we can’t open it for both .
• There is no CTRL+Z here !!, because files are
sequential (no random access) .
• Can’t modify it ! (use another file to help) .
• There is a physical name for each file (URL) .
• To define a text file we write :
Var
F : Text;
• We use “Assign” keyword to link file name
with physical name :
Assign(var F:Text; Filename:String);
• File name can be just name if it’s in the same
folder of the program, but if not , we have to
write all the path of the file .
T-file:
Definition and assign:
Create
Open to write & OVERRIDE Rewrite (logicalFileName);