BCX Console Demonstration Program s116.bas

 '=========================================== 
 'Read & Write Ini Files Easily Using BCX 
 '=========================================== 
 DIM Length
 DIM Info$
 DIM MyIni$
 
 MyIni$ = TEMPDIR$ & "\test-ini.ini"
 
 PutIni("Header", "Title", "Value", MyIni$)
 Info$ = GetIni("Header", "Title", MyIni$)
 PRINT Info$
 
 SUB PutIni(Section$, Var$, Value$, File$)
   WritePrivateProfileString(Section$, Var$, Value$, File$)
 END SUB
 
 FUNCTION GetIni$(Section$, Var$, File$)
   DIM Buffer$ * MAX_PATH
   Length = GetPrivateProfileString(Section$, Var$, "", Buffer$, MAX_PATH, File$)
   Buffer$ = LEFT$(Buffer$, Length)
   FUNCTION = Buffer$
 END FUNCTION

Result:


 Value