[futurebasic] Re: [FB] Saving Records to Disk

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Fri, 7 Nov 2008 17:38:37 +1300
Peter wrote:

> BEGIN RECORD MaterialStock
> DIM AS STR31    Size
> DIM AS LONG     Length
> DIM AS LONG     QtyNow
> DIM AS STR15    Yield
> DIM AS STR15    Heat
> DIM AS STR15    OrdDate
> DIM AS STR15    RcdDate
> DIM AS LONG     WeightRcd
> DIM AS STR31    Supplier
> DIM AS STR15    OrderNo
> DIM AS LONG     QtyRcd
> DIM AS LONG     Weight
> DIM AS DOUBLE   CostperPound
> DIM AS LONG     WeightNow
> DIM AS STR31    TrackingNo
> END RECORD
>
> begin globals
> DIM AS MaterialStock  StockL(3,30,30) '(X,Y,Z) X = Yield ,Y = Size,  
> Z = Items

>  What would be the best way to save to disk?
> I assume the FSSpec or FSRef is the way to go, but do I step through  
> like so
> FOR x = 0 to 3
> FOR y = 0 to 30
> FOR z = 0 to 30
> WRITE #1 StockL(x,y,z)
> NEXT z
> NEXT y
> NEXT x
>
> Or is there a more modern way, this just seems clunky

write file #1, @StockL(0, 0, 0), sizeof( MaterialStock )*(3 + 1)*(30 +  
1)*(30 + 1)
To read back in:
read file #1, @StockL(0, 0, 0), sizeof( MaterialStock )*(3 + 1)*(30 +  
1)*(30 + 1)

Robert P.