PROFILE.Open

Previous  Next

 

hHandle = PROFILE.Open( FileName AS STRING, 

                        Type     AS INTEGER,

                        root     AS STRING = "" ) AS HANDLE

 


 

Opens a profile file.  The profile file name may contain one of the MyBASIC2 Session variable.

 

The profile can be of type XML or INI.  The types are defined as

 

' Profile Constants

CONST EL_Auto           = 0

CONST EL_XML            = 1

CONST EL_INI            = 2

CONST EL_REG            = 3

 

When type is set to AUTO, the file extension will determine the profile type.

 

Example:

 

$LIBRARY "MyBASIC2_ExtLib.dll"

 

DIM hHandle AS HANDLE

 

hHandle = PROFILE.Open( "d:\kalle.xml" )

 

IF hHandle <> NULL THEN

  PROFILE.Write( hHandle, "Person", "Name:First", "Kalle" )

  PROFILE.Write( hHandle, "Person", "Name:Last", "Anka" )

  PROFILE.Write( hHandle, "Person", "Age", 54 )

  PROFILE.Write( hHandle, "Person", "Weight", 164.5 )

  PROFILE.Close( hHandle )

ENDIF

 

END