SD & D Sequential Files
-
Upload
forrester-high-school -
Category
Education
-
view
23 -
download
2
Transcript of SD & D Sequential Files
Sequential FilesA sequential file is a collection of data items stored on a
backing storage device
Data items are stored in the file one after the other
To access a specific data item, we must first read through all of the preceding data items (in sequence) until we reach the data item we want
Sequential files use an end-of-file (EOF) marker to indicate that the end of the file has been reached
File OperationsThere are a number of file operations which can be performed on a sequential file. We are only interested in the following:OpenCreateCloseReadWriteDelete
CreatePseudocode:CREATE Filename
LiveCode:
(opens the file, if it doesn’t exist then LiveCode will create it)
ReadPseudocode:
OPEN FilenameREPEAT UNTIL EOF
READ next record from Filename into field / arrayEND REPEATCLOSE Filename
WritePseudocode:
OPEN FilenameREPEAT UNTIL EOF
WRITE next field/array element to FilenameEND REPEATCLOSE Filename