Page 1 of 1

How to write/read INI-files on the "sunny" way?

Posted: Wed Jan 27, 2010 9:45 am
by lnxque
Is there an easy solution for this Windows-code available under Linux?

Code: Select all

Procedure.s INI_Lesen(Bereich.s, Eintrag.s, Datei.s)
  Protected rueck.l, tmp.s
  tmp = Space(255)
  rueck = GetPrivateProfileString_(Bereich, Eintrag, tmp, @tmp, 255, Datei)
  ProcedureReturn Left(tmp, rueck)
EndProcedure

Procedure INI_Schreiben(Bereich.s, Eintrag.s, Wert.s, Datei.s)
  Protected rueck.l
  If Trim(Eintrag) = ""
     ;Bereich entfernen 
     rueck = WritePrivateProfileString_(Bereich, 0, 0, Datei)
  ElseIf Trim(Wert) = "" 
     ;Eintrag entfernen
     rueck = WritePrivateProfileString_(Bereich, Eintrag, 0, Datei)
  Else
     ;Eintrag schreiben/ändern
     rueck = WritePrivateProfileString_(Bereich, Eintrag, Wert, Datei)
  EndIf
EndProcedure


Re: How to write/read INI-files on the "sunny" way?

Posted: Wed Jan 27, 2010 2:27 pm
by Fred
Preferences library ?

Re: How to write/read INI-files on the "sunny" way?

Posted: Thu Jan 28, 2010 9:28 am
by lnxque
Solved (in parts). Wrote (reading)/will write (writing) the functionality in PB.