two_array(n) manual page

Back to the Index
Table of Contents

Name

two_array - Load and save TCL arrays

Synopsis

package require twoArray ?1.0?
two_arrray load|save fileName arrayName ?force?

Description

Load and save TCL arrays to/from a file. This is very useful for simple configuration files: set elements of an array and save/load it. It does not use Tcl's list formating rules, which might be an advantage or not.

Commands

two_array takes all of the TCL array(n) command and the following two additional commands to load/save an array:
two_array load fileName arrayName ?force?
Open file fileName and fill array arrayName with the content. If force (a TCL_BOOLEAN value) is set to true then the file is required to exist, or the program will print an error message and exit.
two_array save fileName arrayName
Save array arrayName to file fileName.

Coding

Array files are coded as lines of key:value pairs. key and value are taken almost literally from the array except for some character replacements:
<NL>
replaced by '%n'.
:
replaced by '%d'.
%
replaced by '%p'.

Author

Frank J. Leitner
frank@fjl.de

See Also

array(n) .


Table of Contents


Back to the Index