
'*******************************************
'*                                         *
'* Demo de xWrite                          *
'* Sauvegarde des données avec xWrite()    *
'* --------------------------------------- *
'*                                         *
'* Auteur : Wolf-Gideon Bleek              *
'* Date   : July 10,1988                   *
'* Version: 1.0                            *
'* Système d'expl. : V1.2 & V1.3           *
'*                                         *
'******************************************

OPTION BASE 1
'les bibliothèques sont sur la disquette T1&T2, les vôtres se 'trouvent peut-être ailleurs
LIBRARY "T&A2:bmaps/dos.library"

DECLARE FUNCTION xOpen& LIBRARY
DECLARE FUNCTION xRead& LIBRARY
DECLARE FUNCTION xWrite& LIBRARY
'                xClose

DIM Matrix%(10,10)


WIDTH 70

FOR i = 1 TO 10
  FOR j = 1 TO 10
     Matrix%(i,j) = RND*10
     PRINT Matrix%(i,j);" ";
  NEXT j
PRINT
NEXT i
PRINT



File$ = "Matrix"+CHR$(0)

Handle& = xOpen&(SADD(File$), 1006)

  Amount& = xWrite&(Handle&, VARPTR(Matrix%(1,1)), 200&)

CALL xClose(Handle&)

FOR i = 1 TO 10
  FOR j = 1 TO 10
     Matrix%(i,j) = 0
NEXT j
NEXT i


Handle& = xOpen&(SADD(File$), 1005)

  Amount& = xRead&(Handle&, VARPTR(Matrix%(1,1)), 200&)

CALL xClose(Handle&)


FOR i = 1 TO 10
  FOR j = 1 TO 10
     PRINT Matrix%(i,j);" ";
  NEXT j
  PRINT
NEXT i
PRINT
