CFLib.org – Common Function Library Project

getProfile(iniFile)

Last updated October 23, 2005

author

Giampaolo Bellavite

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
Returns a struct of structs. Each initialization file section name is the key of the first struct. Each entry is a name-value pair struct in its own section.

Return Values:
Returns a structure.

Example:

<cfdump var="#getProfile('C:\WINDOWS\win.ini')#">

Parameters:

Name Description Required
iniFile Full path to ini file to read. Yes

Full UDF Source:

/**
 * Gets all initialization file entries.
 * 
 * @param iniFile      Full path to ini file to read. (Required)
 * @return Returns a structure. 
 * @author Giampaolo Bellavite (giampaolo@bellavite.com) 
 * @version 1, October 23, 2005 
 */
function getProfile(iniFile) {
    var sections = getProfileSections(iniFile);
    var sectionName = "";
    var retProfile = structNew();
    var i = "";
    var entry = "";
    
    for (sectionName in sections) {
        retProfile[sectionName] = structNew();
        for (i=1;i LTE listLen(sections[sectionName]);i=i+1) {
            entry = listGetAt(sections[sectionName],i);
            retProfile[sectionName][entry]=getProfileString(iniFile,sectionName,entry);
        }
    }
    return retProfile;        
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson