Registriert seit: 21. Feb 2004
1.008 Beiträge
Turbo Delphi für Win32
|
Re: memo in ini speichern
26. Apr 2005, 22:08
So sollte es auf jeden Fall gehen:
Delphi-Quellcode:
//zum speichern:
//ini.writestring('Name','Schlüssel',MemoToHexString(memo1);
//und zum laden:
//Memo1.lines.commatext := HexStringToMemo(ini.readstring('Name', 'Schlüssel', 'Fehler'))
function MemoToHexString(MEMO: TMemo): string;
function StrToHexString(const s : string):string;
begin
if s = '' then
Result := ''
else
begin
SetLength(Result, Length(s)*2);
BinToHex(PChar(s), PChar(Result), Length(s));
end;
end;
begin
Result := StrToHexString(MEMO.Lines.CommaText);
end;
function HexStringToMemo(HS: String):string;
function HexStringToStr(s : string):string;
begin
if s = '' then
Result := ''
else
begin
if Odd(length(s)) then
s := '0'+s;
SetLength(Result, Length(s) div 2);
HexToBin(Pchar(s), PChar(Result), Length(Result));
end;
end;
begin
result := hexstringtostr(hs);
end;
|
|
Zitat
|