PROFILE.Read

Previous  Next

 

result = PROFILE.Read( hHandle   AS HANDLE,

                       key       AS STRING, 

                       valuename AS STRING,

                       default   AS VARIANT ) AS VARIANT

 


 

Read a value from the profile using the key and valuename.  You can add additional sub trees by adding tokens to valuename delimited by a colon ':'

 

For example "Name:First".

 

Example:

 

$LIBRARY "MyBASIC2_ExtLib.dll"

 

DIM Name AS STRING

DIM Age AS INTEGER

DIM Weight AS REAL

 

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

 

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

 

IF hHandle <> NULL THEN

  Name = PROFILE.Read( hHandle, "Person", "Name:First", "" ) + " " + PROFILE.Read( hHandle, "Person", "Name:Last", "" )

  Age = PROFILE.Read( hHandle, "Person", "Age", 18 )

  Weight = PROFILE.Read( hHandle, "Person", "Weight", 200 )

  PROFILE.Close( hHandle )

ENDIF

 

END