i just started with Spiderbasic. My Problem: I have Example.txt File with the Syntax : 890, 1000, 1100, 935,....
I want to start read the data into a array or a list. I dont know how to seperate the data with the "," as a Split Char. The Debug ReadString shows me the whole Data in the Debug Window, but again i dont know how to split the data and wirte them into a array or list.
(In the end i want a live version of reading the data but that is far away )
Here you see my code until now:
Code: Select all
ExamineDesktops()
Procedure DateiEinlesen(Status, Filename$, File, Size)
CloseWindow(0)
If Status = #PB_Status_Loaded
Debug "File: " + Filename$ + " - Size: " + Size + " bytes"
Debug "Reading first 100 lines:"
NewList MyList()
While Eof(0) = 0 And NbLine < 100 ;Die ersten 100 Lines werden ausgelesen
Debug ReadString(0)
NbLine+1
Wend
CloseFile(0)
OpenWindow(0, 0, 0, 1280, 875, "MittigesFenster")
ElseIf Status = #PB_Status_Error
Debug "Error when loading the file: " + Filename$
EndIf
EndProcedure
Procedure DieDateiLesen()
If NextSelectedFile()
ReadFile(0, SelectedFileID(), @DateiEinlesen(), #PB_LocalFile)
EndIf
EndProcedure
Procedure ChooseFileEvent()
OpenFileRequester("text/plain",@DieDateiLesen())
EndProcedure
OpenWindow(0, 0, 0, 300, 50, "Read file example", #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 280, 30, "Choose a text file...")
BindGadgetEvent(0, @ChooseFileEvent())