'===========================================================================
' Subject: SAVE & READ ARRAYS TO DISK         Date: 10-15-99 (13:11)       
'  Author: Dave Navarro, Jr.                  Code: PBCC, PBDLL            
'  Origin: dave@powerbasic.com              Packet: PBCC.ABC
'===========================================================================
'
' Save and Read arrays to disk
' for PB/DLL 6.0 and PB/CC 2.0
' by Dave Navarro, Jr. (dave@powerbasic.com)
'

#INCLUDE "WIN32API.INC"

SUB SaveToDisk(BYVAL file AS STRING, ANY, BYVAL bytes AS LONG)

#REGISTER DEFAULT

  LOCAL where AS LONG

  ! mov where, [EBP+12]

  OPEN file FOR BINARY AS #1
  SETEOF 1
  WriteFile FILEATTR(1, 2), BYVAL where, bytes, where, BYVAL %NULL
  CLOSE #1

END SUB

SUB ReadFromDisk(BYVAL file AS STRING, ANY, BYVAL bytes AS LONG)

#REGISTER DEFAULT

  LOCAL where AS LONG

  ! mov where, [EBP+12]

  OPEN file FOR BINARY AS #1
  ReadFile FILEATTR(1, 2), BYVAL where, bytes, where, BYVAL %NULL
  CLOSE #1

END SUB
