2.2.3(b) File handling Flashcards
1
Q
open =
A
= open(…)
eg. myFile = open(“sample.txt”)
2
Q
close =
A
= .close()
eg. myFile.close()
3
Q
read line =
A
= .readLine()
eg. myFile.readLine()
4
Q
write line=
A
= .writeLine()
eg. myFile.writeLine(“Add new line”)
5
Q
end of file =
A
= .endOfFile()
eg. while NOT myFile.endOfFile()
print (myFile.readLine())
endwhile
6
Q
create a new file =
A
= newFile()
eg. newFile(“myText.txt”)