CIE Pseudocode – File Handling

Reading Files

Reading Text Files

CIE Pseudocodes reading of text files is really weird but pretty easy to get your head around if you abandon logic and reason.

Look at the example below and note:

File read objects aren’t assigned to an identifier

The temporary variable (

Example using while loop:

OPENFILE animals.txt FOR READ

WHILE NOT EOF animals.txt DO
    READFILE animals.txt, item
    OUTPUT item
ENDWHILE
CLOSEFILE animals.txt

File opening options: READ, WRITE, APPEND

 

Writing Files

Writing Text Files

 

 

Reading Random Files