Hash Load, Hash Save

Purpose

Loads or saves a hash table from a file.

Syntax

Hash Load name[] , file$ | #n

Hash Save name[] , file$ | #n

Description

Hash Save saves a hash table in the file file$ or in a file with channel #n, which is previously opened with Open. The hash table is stored in a fast binary format and is reloaded using Hash Load.

Example

Dim ha As Hash Double // If this is variant, Hash Save/Load does not work

ha["new"] = 2.3

Hash Save ha[], App.Path & "\hash_ha.dat"

Hash Erase ha[]

Hash Load ha[], App.Path & "\hash_ha.dat"

Print ha["new"]

Kill App.Path & "\hash_ha.dat" // Tidy-up line

or

Dim ha As Hash Double // If this is variant, Hash Save/Load does not work

ha["new"] = 2.3

Hash Save ha[], App.Path & "\hash_ha.dat"

Hash Erase ha[]

Open "hash_ha.dat" for Input As # 1

Hash Load ha[], # 1

Close # 1

Print ha["new"]

Kill App.Path & "\hash_ha.dat" // Tidy-up line

Remarks

See Hash for more information on the Hash table.

Hash Save/Load does not seem to work with Variants; use Hash Write/Input instead.

See Also

Hash Add, Hash Erase, Hash Input, Hash Remove, Hash Sort, Hash Write

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}