Skip to content

dos_setini

Dale Fugier edited this page Nov 5, 2020 · 1 revision

Copies a string into the specified section of the Windows-style initialization (.INI) file. An initialization file must have the following form:

[section]
entry=string
...

Syntax

(dos_setini section entry string filename)

Parameters

section

The section to which the string will be copied. If section does not exist, it is created.

entry

The name of the entry to be associated with string. If entry does not exist in the specified section, it is created. If entry is nil, the entire section, including all entries within the section, is deleted.

string

The string to be written to the file. If this parameter is nil, the entry pointed to by entry is deleted.

filename The name of the initialization file. If filename does not exist, the function creates the file. The specified directory must already exist.

Note, parameters are not case sensitive, so section and entry may be in any combination of uppercase and lowercase characters. Also, to improve performance, Windows keeps a cached version of the most recently accessed initialization file. If filename is specified and the other arguments are nil, Windows flushes the cache. This function always returns nil after flushing the cache, regardless of whether the flush succeeds or fails.

Returns

A qualified path name to filename if successful.

nil on error.

Examples

Command: (dos_setini "section1" "entry1" "string1" "filename.ini")
"C:\\Program Files\\AutoCAD 2006\\filename.ini"

Command: (dos_setini "section1" "entry2" "string2" "filename.ini")
"C:\\Program Files\\AutoCAD 2006\\filename.ini"

Command: (dos_setini "section2" "entry1" "string1" "filename.ini")
"C:\\Program Files\\AutoCAD 2006\\filename.ini"
Clone this wiki locally