Files
harbour-core/contrib/hbnf/tests/savearr.prg
Przemysław Czerpak 96ca3fe470 2014-01-21 20:41 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* Makefile
  * config/*
  * contrib/*
  * doc/*
  * extras/*
  * include/*
  * lib/*
  * package/*
  * src/*
  * tests/*
  * utils/*
    * removed empty lines left after removed '$' + 'Id' + '$' identifiers
2014-01-21 20:41:05 +01:00

44 lines
926 B
Plaintext

#require "hbnf"
PROCEDURE Main()
LOCAL aArray := { ;
{ "Invoice 1", hb_SToD( "19910415" ), 1234.32, .T. }, ;
{ "Invoice 2", Date(), 234.98, .F. }, ;
{ "Invoice 3", Date() + 1, 0, .T. } }, aSave
LOCAL nErrorCode := 0
Set( _SET_DATEFORMAT, "yy-mm-dd" ) /* TOFIX: RTEs with "yyyy-mm-dd" */
ft_SaveArr( aArray, "invoice.dat", @nErrorCode )
IF nErrorCode == 0
CLS
DispArray( aArray )
aSave := ft_RestArr( "invoice.dat", @nErrorCode )
IF nErrorCode == 0
DispArray( aSave )
ELSE
? "Error restoring array"
ENDIF
ELSE
? "Error writing array"
ENDIF
RETURN
FUNCTION DispArray( aTest )
LOCAL nk
FOR nk := 1 TO Len( aTest )
? aTest[ nk, 1 ]
?? " "
?? DToC( aTest[ nk, 2 ] )
?? " "
?? Str( aTest[ nk, 3 ] )
?? " "
?? iif( aTest[ nk, 4 ], "true", "false" )
NEXT
RETURN NIL