[futurebasic] Re: [FB] Records & Files

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2000 : Group Archive : Group : All Groups

From: Bill Wharrie <BillWharrie@...>
Date: Wed, 8 Mar 2000 19:09:35 -0500
Ken:
  You've left out the "recLen" (record length) parameter.

  From the Reference Manual:
     "OPEN "method[fork]",fileID,path$  [,[recLen][,refNum% [,dirID&]]]

* recLen This value indicates the length of the records in the file;
naturally, it's most useful when the file consists of fixed-length records.
 The value you specify is used when you execute statement and functions
such as RECORD, REC, LOC and LOF.  If you omit this parameter, a default
value of 256 is used.  If the file doesn't consist of fixed-length records,
it's often most convenient to set recLen to 1."

My changes/comments are marked as comments thus: ' <<< comment

BEGIN Record hData
     DIM 40 job$     'gJobName$
     DIM 20 jnumb$'gJobNo$
     DIM 40 owner$'
     DIM 10 designstorm$
     DIM 10 stormhour$
     .
     .    
     .
     DIM 10 Stage$(15)
     DIM 10 Storage$(15)
     DIM 10 Discharge$(15)
END Record _hydroDataSize  ' <<< add record length constant
DIM theHydrodata as hdata

I want to save to  file I am using the following statements

OPEN "O",1,gFileNameHydro$,_hydroDataSize,gFileVolHydro% '<<specify record
size
RECORD #1, gHydroDataRecNum  ' << specify which record
WRITE #1, theHydrodata
CLOSE #1

Then trying to read back with

OPEN "I",1,gFileNameHydro$,_hydroDataSize,gFileVolHydro% '<<specify record
size
RECORD #1, gHydroDataRecNum  ' << specify which record
Read #1, theHydrodata
CLOSE #1


Hope this helps
  -- Bill Wharrie