xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

RESTORE

Loads dynamic memory variables from disk into memory.

Syntax

RESTORE FROM <memFilename> [ADDITIVE]

Arguments

FROM <memFilename>
This is the name of the memory file to open. It can include path and file extension. When no path is given, the file is searched in the current directory. The default file extension is MEM. <memFilename> can be specified as a literal file name or as a character expression enclosed in parentheses.
ADDITIVE
This option specifies that the dynamic variables should be loaded in addition to existing ones. If the option is omitted, all dynamic memory variables currently available are released first.

Description

The RESTORE command loads dynamic memory variables previously stored with the SAVE command from a memory file. The default extension for memory files is MEM.

Dynamic memory variables are PRIVATE and PUBLIC variables. Their symbolic names exist at runtime of an application. Thus, the symbolic names are re-created from a memory file with the RESTORE command. If dynamic variables of the same name are visible when the command is executed, they are overwritten with the values stored in the memory file. Variables that do not exist are created new as PRIVATE variables.

When the ADDITIVE clause is not specified, all currently existing dynamic variables are released befor the memory file is loaded.

GLOCBAL, LOCAL and STATIC variables are not affected by the RESTORE command.

Info

See also:GLOBAL, HB_DeSerialize(), LOCAL, PRIVATE, PUBLIC, RESTORE, STATIC
Category: Memory commands
Source:vm\memvars.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates saving and restoring of dynamic memory
// variables.

   PROCEDURE Main
      PRIVATE cString1, cString2

      PUBLIC dDate   := Date()
      PUBLIC lLogic  := .F.


      SAVE TO AllVars

      SAVE ALL LIKE c* TO StringVar

      SAVE ALL EXCEPT cString? TO SomeVars

      RELEASE ALL
      CLEAR MEMORY

      RESTORE FROM AllVars
      RESTORE FROM StringVar
      RESTORE FROM SomeVars
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe