File tree Expand file tree Collapse file tree 2 files changed +31
-6
lines changed
Expand file tree Collapse file tree 2 files changed +31
-6
lines changed Original file line number Diff line number Diff line change @@ -79,19 +79,24 @@ print(names[3])
7979Array board[8,8]
8080board[0,0]="rook"
8181
82- // File IO not done
83- myFile = openRead("sample.txt")
82+ // File IO
83+ myFile = openRead("sample-read .txt")
8484x = myFile.readLine()
8585myFile.close()
86+ print("First line below")
87+ print(x)
88+ print()
8689
87- myFile = openRead("sample.txt")
90+ myFile = openRead("sample-read .txt")
8891while NOT myFile.endOfFile()
8992 print(myFile.readLine())
9093endwhile
9194myFile.close()
95+ print()
96+ print()
9297
93- myFile = openWrite("sample.txt")
94- myFile.writeLine("Hello World ")
98+ myFile = openWrite("sample-write .txt")
99+ myFile.writeLine("THIS IS A SAMPLE TEXT FILE CREATED TO SHOW THE WRITE FUNCTIONALITY ")
95100myFile.close()
96101
97102print("Hello World") //This is a comment
Original file line number Diff line number Diff line change @@ -102,4 +102,24 @@ switch something:
102102 print("#Douglas Adams")
103103 default:
104104 print("You are a slave to the system")
105- endswitch
105+ endswitch
106+
107+ // File IO
108+ myFile = openRead("sample-read.txt")
109+ x = myFile.readLine()
110+ myFile.close()
111+ print("First line below")
112+ print(x)
113+ print()
114+
115+ myFile = openRead("sample-read.txt")
116+ while NOT myFile.endOfFile()
117+ print(myFile.readLine())
118+ endwhile
119+ myFile.close()
120+ print()
121+ print()
122+
123+ myFile = openWrite("sample-write.txt")
124+ myFile.writeLine("THIS IS A SAMPLE TEXT FILE CREATED TO SHOW THE WRITE FUNCTIONALITY")
125+ myFile.close()
You can’t perform that action at this time.
0 commit comments