次の方法で共有


RESTORE FROM Command

Retrieves variables and variable arrays saved in a variable file or a memo field and places them into memory.

RESTORE FROM FileName | MEMO MemoFieldName   [ADDITIVE]

Parameters

  • FileName
    Specifies the variable file from which the variables and arrays are restored. Variable files are assigned a .mem extension.

  • MEMO MemoFieldName
    Specifies the memo field from which variables and arrays are restored.

  • ADDITIVE
    Prevents any variables or arrays currently in memory from being erased. If the number of variables or arrays being added with ADDITIVE plus the number of existing variables exceeds the variable limit, Microsoft Visual FoxPro brings as many variables and arrays as possible into memory from the variable file or memo field.

    If you restore a variable or array that has the same name as an existing variable or array, the value in the existing variable or array is overwritten with the value of the restored variable or array.

Remarks

When RESTORE FROM is issued in a program, all PUBLIC and PRIVATE variables and arrays are restored as PRIVATE; all LOCAL variables and arrays are restored as LOCAL. If RESTORE is issued in the Command window, PUBLIC and PRIVATE variables and arrays are restored as PUBLIC; LOCAL variables and arrays are restored as LOCAL.

RESTORE FROM clears any variables or arrays currently in memory unless you include the ADDITIVE keyword. RESTORE FROM does not affect system variables.

Note that object type variables cannot be restored from a variable file or memo field.

Example

In the following example, two variables are created. They are saved to a variable file and restored without clearing the existing variables.

gnVal1 = 50
gcVal2 = 'Hello'
SAVE TO temp
CLEAR MEMORY

gdVal3 = DATE( )
RESTORE FROM temp ADDITIVE
CLEAR
DISPLAY MEMORY LIKE g*

See Also

DIMENSION | PUBLIC | PRIVATE | RELEASE | SAVE TO | STORE