REWIND statement

Purpose: REWIND moves the read/write pointer of a file to the beginning of the file without the need to close and then re-open the file.


 Syntax:

 REWIND(FileHandle)

 Parameters:

  • FileHandle Handle of the file in which the read/write pointer is to be moved.

Example: Print the 1st line of the file "test.txt" 3 times.


 DIM a$
 OPEN "test.txt" FOR INPUT AS 1
 FOR INTEGER j = 1 TO 3
  LINE INPUT 1,a$
  PRINT a$
  REWIND(FP1) '<<< Reset File Pointer
 NEXT
 CLOSE