Difference between revisions of "INI GET()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
{{YLM to do}}
 
 
==Purpose==
 
==Purpose==
 
Function to return the value from a key in a specified section of an 'ini' file
 
Function to return the value from a key in a specified section of an 'ini' file
Line 5: Line 4:
  
 
==Syntax==
 
==Syntax==
INI_GET(<expC1>, <expC2>[[[, <expC3>], <expC4>], <expL>])  
+
INI_GET(<expC1>, <expC2>, <expC3>, <expC4>[, <expL>])  
  
  
Line 14: Line 13:
 
==Description==
 
==Description==
 
The INI_GET() function returns the value from an individual key in a specified section of an 'ini' file.  The value is returned as a character string.
 
The INI_GET() function returns the value from an individual key in a specified section of an 'ini' file.  The value is returned as a character string.
 +
  
 
{| class="wikitable"
 
{| class="wikitable"
 
!Parameter||Description
 
!Parameter||Description
 
|-
 
|-
|<expC1>||Name of the section
+
|<expC1>||Name of the section.
 
|-
 
|-
|<expC2>||Name of the key
+
|<expC2>||Name of the key.
 
|-
 
|-
|<expC3>||Default value to return if key does not exist
+
|<expC3>||Default value to return if key does not exist.
 
|-
 
|-
|<expC4>||Name of the ini file
+
|<expC4>||Name of the ini file.
 
|-
 
|-
|<expL>||.T. if macros should be expanded, .F. if macros should not be expanded
+
|<expL>||.T. to expand macros, .F. to return macros without expanding.  If this optional parameter is not included, macro expansion defaults to .F. (false).
 
|}
 
|}
  
Line 43: Line 43:
 
; You can include macros in the key/value pairs.
 
; You can include macros in the key/value pairs.
 
  key3 = This is $(key2) and $(key1)
 
  key3 = This is $(key2) and $(key1)
 
+
# end of test.ini
 
</code>
 
</code>
 
<code lang="recital">
 
<code lang="recital">
key1value = ini_get('global','key1',
+
key1value = ini_get('global','key1','unset','test.ini',.T.)
 
</code>
 
</code>
 +
  
 
==Products==
 
==Products==
 +
Recital, Recital Server
 +
 +
[[Category:Documentation]]
 +
[[Category:Functions]]
 +
[[Category:INI Files]]
 +
[[Category:INI Files Functions]]

Latest revision as of 17:25, 5 November 2009

Purpose

Function to return the value from a key in a specified section of an 'ini' file


Syntax

INI_GET(<expC1>, <expC2>, <expC3>, <expC4>[, <expL>])


See Also

INI_GETSECTION(), INI_SET(), INI_SETSECTION()


Description

The INI_GET() function returns the value from an individual key in a specified section of an 'ini' file. The value is returned as a character string.


Parameter Description
<expC1> Name of the section.
<expC2> Name of the key.
<expC3> Default value to return if key does not exist.
<expC4> Name of the ini file.
<expL> .T. to expand macros, .F. to return macros without expanding. If this optional parameter is not included, macro expansion defaults to .F. (false).


Example

# test.ini
# comment lines are preceeded by a '#' 
; or a ';'
#
# "Sections" are enclosed in [ and ]
[global]
; key/value pairs are contained in the sections and are written like this
 	key1 = value
 	key2 = value2
; You can include macros in the key/value pairs.
 	key3 = This is $(key2) and $(key1)
# end of test.ini
key1value = ini_get('global','key1','unset','test.ini',.T.)


Products

Recital, Recital Server