Page 1 of 1

File Seek

Posted: Sun Apr 27, 2003 3:27 am
by Zooker
Can anyone email me a snippet of code showing how to use File Seek! 8) 8)

Re: File Seek

Posted: Sun Apr 27, 2003 5:37 am
by ricardo
Zooker wrote:Can anyone email me a snippet of code showing how to use File Seek! 8) 8)
See this example:

Code: Select all

If OpenFile(0,"test.txt")           ; Create a new file for testing 
  For i = 0 To 20
    WriteStringN("Line #" + Str(i)) ; write one line at time
  Next i
CloseFile(0)                        ; Close the file
EndIf

If OpenFile(1,"test.txt")           ; Now we will read the file
  FileSeek(100)                     ; But start reading at one specific point of the file
  Line$ = ReadString()              ; read at this point
  MessageRequester("",Line$,0)      ; See the string readed
  CloseFile(1)
  DeleteFile("test.txt")            ;delete the file
EndIf
You can change the value of FileSeek() and see what happens. Hope this helps.

Posted: Sun Apr 27, 2003 6:25 am
by Zooker
Thanx ricardo, your help is appreciated! :wink: