RTT wrote:
>> It is not that easy!
>> The code above might work if String maps to an AnsiString,
>> however fails if String maps to a UnicodeString ( Delpi 2009 ).
> This little modification does the job in D2009
> uses  rtlconsts;
> ...
> procedure TMyUnicodeIniFile.WriteString(const Section, Ident, Value:
> string);
> var s:Ansistring;
> begin
> s:=Utf8Encode(Value);
>  if not WritePrivateProfileStringA(PAnsiChar(AnsiString((Section))),
> PAnsiChar(AnsiString((Ident))),
>                                   PAnsiChar(s),
> PAnsiChar(AnsiString((FileName)))) then
>    raise EIniFileException.CreateResFmt(@SIniFileWriteError,
> [FileName]); end;

Yes, that should work and is the bare minimum required for use
in the demos. Though it cannot handle a possible BOM.

Arno Garrels
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to