Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - restore initialize variables saved in a file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 restore             Initialize variables saved in a file
------------------------------------------------------------------------------
 Syntax
   restore variables from cFile

 Arguments
   variables is a list of variables.
   cFile is the name of the file where values are stored.

 Description
   The restore command initializes variables from a memory variable file.
   Unless the cFile argument has an explicit extension, .mem is assumed.

   restore assumes that the destination and source variables are of
   the same type and size. Otherwise, program errors are likely to occur.
   Field variables may not be restored.

   Arrays may also be saved and restored by using the syntax aArrayName[].
   Do not specify an array element. The entire array has to be saved and
   restored. Be sure that the array is restored to a variable declared with
   the same number of elements as the array that was saved.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   typedef struct DATASTRUCT
      char( 20 ) cName
      char( 15 ) cCity
   enddef
   
   proc Test_restore
   vardef
      char( 15 ) cName
      byte       aBytes[ 200 ]
      DATASTRUCT sData
   enddef
   cName         := "Jennifer"
   aBytes[ 152 ] := 'X'
   sData.cName   := "Bettine"
   sData.cCity   := "L. A."
   save __syscolor[], cName to "test.cfg"
   save sData, aBytes[] to "test.cfg" additive
   ? cName, chr( aBytes[ 152 ] ), sData.cName, sData.cCity
   cName         := "John"
   aBytes[ 152 ] := 'Y'
   sData.cName   := "Thomas"
   sData.cCity   := "Frisco"
   __syscolor[ CLR_STD ] := BLUE_CYAN
   ? cName, chr( aBytes[ 152 ] ), sData.cName, sData.cCity
   restore aBytes[], __syscolor[] from "test.cfg"
   restore cName, sData from "test.cfg"
   ? cName, chr( aBytes[ 152 ] ), sData.cName, sData.cCity
   erase "test.cfg"
   endproc

   proc main
   Test_restore()
   endproc

See Also: save

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson