Hi, i have an code that divide an ansistring into multiple and add it to TStringList:
procedure getString(var List: TStringList; const FileName: string);
var
Memory: TMemoryStream;
text: string;
begin
Memory:= TMemoryStream.Create;
Memory.LoadFromFile(FileName);
setlength(text, Memory.Size);
Memory.ReadBuffer(pointer(text)^, length(text));
Memory.Free;
while (pos(chr(124), text) <> 0) and (length(text) <> 0) do //chr(124) = '|'
begin
List.Add(copy(text, 1, pos(chr(124), text) - 2));
text:= copy(text, pos(chr(124), text) + 1, length(text) - pos(chr(124), text));
end;
And my files is:
<str1>|<str2>|<str3>|...|||||~
While run i have an error. I guess that have some error in my code. Thanks for any help.