1RWARRAY(3am)               GNU Awk Extension Modules              RWARRAY(3am)
2
3
4

NAME

6       writea, reada - write and read gawk arrays to/from files
7

SYNOPSIS

9       @load "rwarray"
10
11       ret = writea(file, array)
12       ret = reada(file, array)
13

DESCRIPTION

15       The  rwarray extension adds two functions named writea().  and reada(),
16       as follows.
17
18       writea()
19              This function takes a string argument, which is the name of  the
20              file to which dump the array, and the array itself as the second
21              argument.  writea()  understands  multidimensional  arrays.   It
22              returns one on success, or zero upon failure.
23
24       reada()
25              is the inverse of writea(); it reads the file named as its first
26              argument, filling in the array named as the second argument.  It
27              clears  the  array  first.  Here too, the return value is one on
28              success and zero upon failure.
29

NOTES

31       The array created by reada() is identical to that written  by  writea()
32       in  the sense that the contents are the same. However, due to implemen‐
33       tation issues, the array traversal order of the  recreated  array  will
34       likely  be different from that of the original array.  As array traver‐
35       sal order in AWK is by default undefined, this is not  (technically)  a
36       problem.   If  you  need to guarantee a particular traversal order, use
37       the array sorting features in gawk to do so.
38
39       The file contains binary data.  All integral values are written in net‐
40       work  byte  order.  However, double precision floating-point values are
41       written as native binary data.  Thus,  arrays  containing  only  string
42       data  can  theoretically  be  dumped on systems with one byte order and
43       restored on systems with a different one, but this has not been tried.
44

EXAMPLE

46       @load "rwarray"
47       ...
48       ret = writea("arraydump.bin", array)
49       ...
50       ret = reada("arraydump.bin", array)
51

SEE ALSO

53       GAWK:  Effective   AWK   Programming,   filefuncs(3am),   fnmatch(3am),
54       fork(3am),   inplace(3am),  ordchr(3am),  readdir(3am),  readfile(3am),
55       revoutput(3am), time(3am).
56

AUTHOR

58       Arnold Robbins, arnold@skeeve.com.
59

COPYING PERMISSIONS

61       Copyright © 2012, 2013, 2018, Free Software Foundation, Inc.
62
63       Permission is granted to make and distribute verbatim  copies  of  this
64       manual  page  provided  the copyright notice and this permission notice
65       are preserved on all copies.
66
67       Permission is granted to copy and distribute modified versions of  this
68       manual  page  under  the conditions for verbatim copying, provided that
69       the entire resulting derived work is distributed under the terms  of  a
70       permission notice identical to this one.
71
72       Permission  is granted to copy and distribute translations of this man‐
73       ual page into another language, under the above conditions for modified
74       versions,  except that this permission notice may be stated in a trans‐
75       lation approved by the Foundation.
76
77
78
79Free Software Foundation          Feb 02 2018                     RWARRAY(3am)
Impressum