Page 1 of 1

Way of checking for end of data

Posted: Tue Feb 14, 2017 2:53 pm
by MrTAToad
At the moment once all data has been read and reading continues, it will generate a browser error. It would be nice to be able to detect in SpiderBasic whether all data has read or not.

Re: Way of checking for end of data

Posted: Wed Feb 15, 2017 11:00 am
by Fangles
What's wrong with doing this? It works with PureBasic and I've tested it on a SpiderBasic application

Code: Select all

Restore BeginDictionary
  While TempString.s <> "_EndDictionary_"
    Read.s TempString.s
     If TempString.s <> "_EndDictionary_"
       ; Do something here
     EndIf
   Wend
   
   TempString.s = "<>"
     
DataSection
  BeginDictionary:
  Data.s "-",               "/space"
  Data.s "_",               "/space"
  Data.s "#",               "/space"
  Data.s "@",               "/space"
  Data.s "!",               "/space"
  Data.s "_EndDictionary_", "_EndDictionary_"
EndDataSection

Re: Way of checking for end of data

Posted: Wed Feb 15, 2017 1:01 pm
by MrTAToad
The problem is if you for get any data terminator the program (or rather the browser) will hang...

Re: Way of checking for end of data

Posted: Thu Feb 16, 2017 1:21 am
by Fangles
MrTAToad wrote:The problem is if you for get any data terminator the program (or rather the browser) will hang...
Weird, the above method works properly for me in PB AND SB without any issues.

Re: Way of checking for end of data

Posted: Fri Mar 10, 2017 3:02 pm
by MrTAToad
Are you omitting the last data line ?

Re: Way of checking for end of data

Posted: Sat Mar 11, 2017 4:10 am
by Fangles
MrTAToad wrote:Are you omitting the last data line ?
No. I needed a recogniseable end of data marker so I didn't have those runaway problems:)

Re: Way of checking for end of data

Posted: Sat Mar 11, 2017 7:15 am
by Fred
I don't see why a marker is a problem, as you define the data yourself

Re: Way of checking for end of data

Posted: Sat Mar 11, 2017 12:16 pm
by MrTAToad
Fred wrote:I don't see why a marker is a problem, as you define the data yourself
It's not - but if you try to read past the end of data, then its a problem.