INI-Dateien erstellen/bearbeiten

#include "inifiles.hpp" //wichtig!!!

void __fastcall TForm1::IniAction(AnsiString IniData)
{
    AnsiString sIniFileName;
    AnsiString IniData;

    sIniFileName = ExtractFilePath(ParamStr(0)) + "IniDatei.ini";

    TIniFile* IniFile = new TIniFile(sIniFileName);
    if (IniFile != NULL)
    {
        IniFile -> UpdateFile();

        // IniData lesen:
        IniData = IniFile -> ReadString("ReadSection", "Key", "Defaultwert");

        // IniData schreiben:
        IniFile -> WriteString("WriteSection", "Key", IniData);

        delete IniFile;
        IniFile = NULL;
    }
}