OPEN FILE "Students.txt" FOR READOpening a file named ‘Names.txt’ in WRITE mode.
DECLARE MyFile : STRING DECLARE Line: STRING MyFile ← "Namelist.txt" // assigning filename to the string MyFile OPENFILE MyFile FOR READ // Opening the file for reading purpose WHILE NOT EOF(MyFile) DO // Reading lines by line from the file till end of file READFILE MyFile, Line // Reads a line from the file to Line OUTPUT Line // Outputting the content of Line ENDWHILE CLOSEFILE MyFile
DECLARE Source: STRING DECLARE Target: STRING DECLARE Line: STRING Source ← "Candidates.txt" Target ← "Finalist.txt" OPENFILE Source FOR READ OPENFILE Target FOR WRITE WHILE NOT EOF(Source) DO READFILE Source, Line WRITEFIILE Target, Line ENDWHILE CLOSEFILE Source CLOSEFILE Target
DECLARE SourceFile : STRING DECLARE TargetFile : STRING DECLARE Line, Class : STRING SourceFile="Students.txt" TargetFile="NewFile.txt" OPENFILE SourceFile FOR READ OPENFILE TargetFile FOR WRITE WHILE NOT EOF(SourceFile) READFILE SourceFile, Line Class ← MID(Line, 20, 3) IF Class="12A" THEN WRITEFILE TargetFile, Line ENDIF ENDWHILE CLOSEFILE SourceFile CLOSEFILE TargetFile
123 Street, New York, USA
info@ictmadesimple.com
+012 345 67890
© www.ictmadesimple.com. All Rights Reserved.