I used following coding in one of my projects. Here formula_* are public memory variables. Also inifiles are different for different financial year (_accyrid).
//------------------- SaveIni
function SaveIni()
local mInifile := alltrim(_accyrid)+".ini"
BEGIN INI FILE (mInifile)
SET SECTION "Formula" ENTRY "EPF" To formula_epf
SET SECTION "Formula" ENTRY "PF_C" To formula_pf_c
SET SECTION "Formula" ENTRY "PF_E" To formula_pf_e
SET SECTION "Formula" ENTRY "ESI_C" To formula_esi_c
SET SECTION "Formula" ENTRY "ESI_E" To formula_esi_e
END INI
return nil
//------------------- ReadIni
function ReadIni()
local mInifile := alltrim(_accyrid)+".ini"
If ! File(mInifile)
SaveIni()
EndIf
BEGIN INI FILE (mInifile)
GET formula_epf SECTION "Formula" ENTRY "EPF"
GET formula_pf_c SECTION "Formula" ENTRY "PF_C"
GET formula_pf_e SECTION "Formula" ENTRY "PF_E"
GET formula_esi_c SECTION "Formula" ENTRY "ESI_C"
GET formula_esi_e SECTION "Formula" ENTRY "ESI_E"
END INI
return nil
Thanks a lot for giving the syntax. Roberto had re-organized Crypt, EditEx, INI and graph libraries. During that time, the doc might have been missed out.
Sudip,
Looks like payroll!?
East or West HMG is the Best. South or North HMG is worth.
...the possibilities are endless.
I have found though that I MUST preinitialize my BEGIN INI variables before being used. This was very frustrating until I resolved it. Just declaring them was not sufficient.
Now in HMG UNICODE version, recently I have found some troubles in INIfiles when is be written. I mean when I use "SET" with variables which contains UNICODE format. If I open INI file with Notepad++, I see that file was written in ANSI mode.
Dear Claudio, do you think this it would be an error or I shall convert all my INI_variables to ANSI mode ?
I have noted in C:\hmg.3.1.4\SOURCE\INI\c_ini.c and C:\hmg.3.1.4\SOURCE\INI\h_ini.prg those are using WritePrivaeProfileString and probably (please confirm) shall be used WritePrivateProfileStringW in place of that.
Or could be the problem in xChar Function at C:\hmg.3.1.4\SOURCE\INI\h_ini.prg, when need to convert UNICODE/ANSI ?
HMGing a better world "Matter tells space how to curve, space tells matter how to move." Albert Einstein