WriteIni

Description:

baWriteIni writes a string into a Windows ini file.

Platforms:

Windows and Macintosh

Usage:

Result = baWriteIni( Section, Keyname, NewValue, IniFile )

Arguments:

String, string, string, string.
Section is the section name of the ini file.
Keyname is the name of the key
NewValue is the string to write into the file.
IniFile is the name if the ini file to use.

Returns:

Integer.
Returns 1 if the function was successful, else 0.

Examples:

Director:
OK = baWriteIni( "CurrentUser", "UserName", "Gary Smith", "Userdat.ini" )

Authorware:
OK := baWriteIni( "CurrentUser", "UserName", "Gary Smith", "Userdat.ini" )
 

Notes:

An entry in a Windows ini file has the following format :

[Section]
Keyname=string

This function will write the string after the equals sign. When using this function, the Section name you use should not include the square brackets around the name. The Keyname should not include the equals sign. For example the ini file for the example above might look something like this

[CurrentUser]
UserName=Gary Smith
Password=mypw
ModulesCompleted=4

The IniFile can be in any directory. On Windows if the full path name is not specified, the file will be created in the Windows directory, on the Macintosh it will be created in the Preferences folder.

The ini file does not have to have an .ini extension: any extension can be used.

If the ini file does not exist, then it will be created.

This function will write a maximum of 32000 characters.

This function will not write Unicode characters.

 

See also:

baReadIni
baFlushIni
baDeleteIniEntry
baDeleteIniSection