File Seek

Just starting out? Need help? Post your questions and find answers here.
Zooker
User
User
Posts: 22
Joined: Sun Apr 27, 2003 1:46 am
Location: So.Illinois USA

File Seek

Post by Zooker »

Can anyone email me a snippet of code showing how to use File Seek! 8) 8)
It took 73 years for me to get this Stupid!
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: File Seek

Post 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.
ARGENTINA WORLD CHAMPION
Zooker
User
User
Posts: 22
Joined: Sun Apr 27, 2003 1:46 am
Location: So.Illinois USA

Post by Zooker »

Thanx ricardo, your help is appreciated! :wink:
It took 73 years for me to get this Stupid!
Post Reply