User Guide

File Access and Multiuser Configuration API 367
int MM_OpenConfigFile()
Availability
Dreamweaver MX.
Description
This function opens the file and returns an operating system file handle. You can use the
operating system file handle in calls to system file functions. You must close the file handle with a
call to the system
_close function.
If the file is a configuration file, it finds the file in either the user Configuration folder or the
Dreamweaver Configuration folder. If you open the Configuration file for writing, the function
creates the file in the user Configuration folder, even if it exists in the Dreamweaver
Configuration folder.
Note: If you want to read the file before writing to it, open the file in "read" mode. When you want to
write to the file, close the read handle and open the file again in "write" or "append"
mode.
Arguments
char *fileURL, char *mode
The char *fileURL argument is a pointer to a string that names the file that you are opening,
which is provided as a file:// URL. If it specifies a path in the Dreamweaver Configuration
folder, the
MM_OpenConfigFile() function resolves the path before opening the file.
The char *mode argument points to a string that specifies how you want to open the file. You
can specify
null, "read", "write", or "append" mode. If you specify "write" and the file does
not exist, the
MM_OpenconfigFile() function creates it. If you specify "write", the
MM_OpenConfigFile() function opens the file with an exclusive share. If you specify "read",
the
MM_OpenConfigFile() function opens the file with a nonexclusive share.
If you open the file in "
write" mode, any existing data in the file is truncated before writing
new data. If you open the file in "
append" mode, any data you write is appended to the end
of the file.
Returns
An integer that is the operating system file handle for this file. Returns -1 if the file cannot be
found or does not exist.
Example
char *dwConfig = "file:///c|/
Program Files/Macromedia/Dreamweaver/
Configuration/Extensions.txt";
int = fileno;
if(MM_ConfigFileExists(dwConfig))
{
fileno = MM_OpenConfigFile(dwConfig, "read");
}