September 25, 2020, 12:22:08 pm

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Writing arrays to files

Started by GWS, January 21, 2012, 01:24:37 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

Hi,

It isn't very clear in the users guide, but ..

WRITE with a BFILE and an array, will write the entire array to the disk file.

READ with a BFILE and an array, will read the entire array in one shot.
                     
If you use a subscript on the array variable, the reading/writing takes place at that location in the array.

A short pseudo code example:
               
DEF a[100]:int
DEF b:BFILE

if OPENFILE(b......
   WRITE b,a[0]: Rem writes all 100 elements of a
   READ b,a[0]: REM reads all 100 elements of a
             ...
etc.                     
                 
If you need to read/write a single element from the array, use a temporary variable to copy to and from the
array.

all the best, :)

Graham                     
                     
Tomorrow may be too late ..

LarryMc

neat; I didn't realize that Graham.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

GWS

 ;D .. just came across it in some old notes ..

Quite a few interesting things .. I'll see if I can find anything else ..

best wishes, :)

Graham
Tomorrow may be too late ..