View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > GetProfileString PreviousNext

GetProfileString

Gets an initialization file entry.

An initialization file assigns values to configuration variables, also known as entries, that are set when the system boots, the operating system comes up, or an application starts. An initialization file has the suffix INI; for example, boot.ini, Win32.ini.

An entry in an initialization file, as a string. If there is no value, returns an empty string.

System functions

GetProfileString(iniPath, section, entry)

GetProfileSections, GetProfileString, SetProfileString

Parameter

Description

iniPath

Absolute path (drive, directory, filename, extension) of initialization file; for example, C:\boot.ini

section

Section of initialization file from which to extract information

entry

Name of value to get

<h3>GetProfileString Example</h3>
Uses GetProfileString to get the value of timeout in an initialization file. Enter
the full path of your initialization file, and submit the form. <!--- If the form was submitted, it gets the initialization path and timeout value specified in the form ---> <cfif Isdefined("Form.Submit")> <cfset IniPath = FORM.iniPath> <cfset Section = "boot loader"> <cfset timeout = GetProfileString(IniPath, Section, "timeout")> <h4>Boot Loader</h4> <!--- If no entry in an initialization file, nothing displays ---> <p>Timeout is set to: <cfoutput>#timeout#</cfoutput>.</p> </cfif> <form action = "getprofilestring.cfm"> <table cellspacing = "2" cellpadding = "2" border = "0"> <tr> <td>Full Path of Init File</td> <td><input type = "Text" name = "IniPath" value = "C:\myboot.ini"> </td> </tr> <tr> <td><input type = "Submit" name = "Submit" value = "Submit"></td> <td></td> </tr></table> </form>

Contents > CFML Reference > ColdFusion Functions > GetProfileString PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


MarkZet said on Nov 24, 2004 at 3:14 AM :
The INI file needs to be encoded in ASCII, Unicode doesn't seem to work.
gonzoprosperity said on May 24, 2005 at 11:29 AM :
The INI spec allows for semi-colons to be placed at the end of a line to allow for comments. Unfortunately, Macromedia's INI implementation blindly reads in these characters and all following text. If you really need to use a comment you have to put it on its own line (probably above). So no inlined comments allowed.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funct106.htm