1inifile(n) Parsing of Windows INI files inifile(n)
2
3
4
5______________________________________________________________________________
6
8 inifile - Parsing of Windows INI files
9
11 package require Tcl 8.2
12
13 package require inifile ?0.2.3?
14
15 ::ini::open file ?access?
16
17 ::ini::close ini
18
19 ::ini::commit ini
20
21 ::ini::revert ini
22
23 ::ini::filename ini
24
25 ::ini::sections ini
26
27 ::ini::keys ini section
28
29 ::ini::get ini section
30
31 ::ini::exists ini section ?key?
32
33 ::ini::value ini section key ?default?
34
35 ::ini::set ini section key value
36
37 ::ini::delete ini section ?key?
38
39 ::ini::comment ini section ?key? ?text?
40
41 ::ini::commentchar ?char?
42
43_________________________________________________________________
44
46 This package provides an interface for easy manipulation of Windows INI
47 files.
48
49 ::ini::open file ?access?
50 Opens an INI file and returns a handle that is used by other
51 commands. access is the same as the first form (non POSIX) of
52 the open command, with the exception that mode a is not sup‐
53 ported. The default mode is r+.
54
55 ::ini::close ini
56 Close the specified handle. If any changes were made and not
57 written by commit they are lost.
58
59 ::ini::commit ini
60 Writes the file and all changes to disk. The sections are writ‐
61 ten in arbitrary order. The keys in a section are written in
62 alphabetical order. If the ini was opened in read only mode an
63 error will be thrown.
64
65 ::ini::revert ini
66 Rolls all changes made to the inifile object back to the last
67 committed state.
68
69 ::ini::filename ini
70 Returns the name of the file the ini object is associated with.
71
72 ::ini::sections ini
73 Returns a list of all the names of the existing sections in the
74 file handle specified.
75
76 ::ini::keys ini section
77 Returns a list of all they key names in the section and file
78 specified.
79
80 ::ini::get ini section
81 Returns a list of key value pairs that exist in the section and
82 file specified.
83
84 ::ini::exists ini section ?key?
85 Returns a boolean value indicating the existance of the speci‐
86 fied section as a whole or the specified key within that sec‐
87 tion.
88
89 ::ini::value ini section key ?default?
90 Returns the value of the named key and section. If specified,
91 the default value will be returned if the key does not exist. If
92 the key does not exist and no default is specified an error will
93 be thrown.
94
95 ::ini::set ini section key value
96 Sets the value of the key in the specified section. If the sec‐
97 tion does not exist then a new one is created.
98
99 ::ini::delete ini section ?key?
100 Removes the key or the entire section and all its keys. A sec‐
101 tion is not automatically deleted when it has no remaining keys.
102
103 ::ini::comment ini section ?key? ?text?
104 Reads and modifies comments for sections and keys. To write a
105 section comment use an empty string for the key. To remove all
106 comments use an empty string for text. text may consist of a
107 list of lines or one single line. Any embedded newlines in text
108 are properly handled. Comments may be written to nonexistant
109 sections or keys and will not return an error. Reading a comment
110 from a nonexistant section or key will return an empty string.
111
112 ::ini::commentchar ?char?
113 Reads and sets the comment character. Lines that begin with this
114 character are treated as comments. When comments are written out
115 each line is preceded by this character. The default is ;.
116
118 This document, and the package it describes, will undoubtedly contain
119 bugs and other problems. Please report such in the category inifile of
120 the Tcllib SF Trackers [http://source‐
121 forge.net/tracker/?group_id=12883]. Please also report any ideas for
122 enhancements you may have for either package and/or documentation.
123
124
125
126inifile 0.2.3 inifile(n)