Iam trying to read the file contents of a txt file from a URL, in the docs it says by ReadFile() that you can use a URL to read from.
I already discovered that i cant use a subdomain in the link, but to need use the full path to the file. Now i get errors, but other than that nothing really much happens.
What do i wrong?
I edited the example code for easier understanding:
Code: Select all
Procedure ReadCallback(Status, Filename$, File, Size)
Debug "ReadCallback"
If Status = #PB_Status_Loaded
Debug "File: " + Filename$ + " - Size: " + Size + " bytes"
; Read the first 10 lines
;
While Eof(0) = 0 And NbLine < 10
Debug ReadString(0)
NbLine+1
Wend
CloseFile(0)
ElseIf Status = #PB_Status_Error
Debug "Error when loading the file: " + Filename$
EndIf
EndProcedure
Procedure OpenFileRequesterCallback()
Debug "OpenFileRequesterCallback"
;If NextSelectedFile()
;Debug "NextSelectedFile"
ReadFile(0, "http://www.dppro.nl/timelinegen/TLG_Tutorial.txt", @ReadCallback() , #PB_File_Streaming)
;EndIf
EndProcedure
; Procedure ChooseFileEvent()
; OpenFileRequester("*.txt", @OpenFileRequesterCallback())
; EndProcedure
OpenWindow(0, 0, 0, 300, 50, "Read file example", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 280, 30, "Choose a file...")
BindGadgetEvent(0, @OpenFileRequesterCallback())