Hi,

I have encountered the value being returned by HB_ReadIni() was being truncated by one char at the last. I have the following function and sample ini file.
Example:

Calling IniFileVal("sample.ini","DOWNLOAD_SRC") would return "d:\tes" instead of "d:\test"

Thanks for any help.

Regards,
Mario

**************
*sample.ini file
[Default Setting]
DOWNLOAD_SRC = d:\test
***********************

*********************************
FUNCTION IniFileVal(cIniFile,cKey, xType)
*********************************
  LOCAL hDefIniFile
  LOCAL hDefaultSetting, xRetVal

IF HB_DbExists(cIniFile);hDefIniFile:=HB_ReadIni( cIniFile, .F., ,.F. );endif // Read ini file in a hash table

  IF xType==NIL;xType:="C";endif

  IF hDefIniFile != NIL
    hDefaultSetting := HGetValueAt( hDefIniFile, 1 )
    xRetVal := hDefaultSetting[cKey]
  ELSE
    Alert("Invalid Definition File")
    break
  ENDIF

  IF xType == "L"
     xRetVal := Val(xRetVal) > 0
  ELSEIF xType == "D"
     xRetVal := CToD(xRetVal)
  ELSEIF xType == "N"
     xRetVal := Val(xRetVal)
  ENDIF

RETURN xRetVal
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to