Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Clyde on May 09, 2006

Title: Problem with Restoring Data Reading.
Post by: Clyde on May 09, 2006
Just looked in the FB Help about using Data statements with in programs.
And am having big problems with using the Restore command to recognize any data labels ( so that it starts at the appropriate data )

Code: [Select]
'
' Data Example Code.
'

Option Explicit
Option Static


Dim A

Dim Cupboard(14)

Restore Dat1

For A=0 to 14

      Read Cupboard(A)

Next

Dat1:
Data -2,-2,0,-1,-2,0,0,-2,0,1,-2,0,2,-2,0

Dat2:
Data 1,2,3,4,5,6,7,8,9,10,11,12,13,14


Any suggestions whats up with Restore and data labels much appreciated.

Cheers,
Clyde.
Title: Re: Problem with Restoring Data Reading.
Post by: Stonemonkey on May 09, 2006
Hi Clyde, that example seem to work ok for me, but if i were to read data inside a sub or function i have some problems unless the data restore label is before the sub/function.
Maybe try placing your data at the start of your code or in an included file.
Title: Re: Problem with Restoring Data Reading.
Post by: Clyde on May 09, 2006
Ok, Cheers I'll try that out.

Big Thanks,
Clyde.
Title: Re: Problem with Restoring Data Reading.
Post by: Clyde on May 09, 2006
That did that trick and yep dude, I was having the same probs as you, with using restore in a sub / func.
Sticking the data and labels before any subs/func's works fantastico. Bit odd, that no ones picked it up over in FBNet world.

Cheers,
Clyde