Why are you using AnsiString at all? You should be using (Unicode)String instead, since that is what the TMemo expects.
In any case, Char is WideChar in D2009+, so SizeOf(Char) is 2 not 1, so you are allocating memory for your AnsiString for only 1/2 of the file data, but then reading the full file into that memory. So you are going to corrupt surrounding memory. Use SizeOf(AnsiChar) instead, which is 1 so you can just drop the SizeOf() altogether.
var
LoadString: AnsiString;
FS: TFileStream;
begin
FS := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone);
try
SetLength(LoadString, FS.Size);
FS.ReadBuffer(Pointer(LoadString)^, FS.Size);
finally
FS.Free;
end;
Memo.Lines.Add(String(LoadString));
end;
Alternatively, there are other options, such as TMemoryStream.LoadFromFile():
uses
System.Classes;
var
LoadString: AnsiString;
MS: TMemoryStream;
begin
MS := TMemoryStream.Create;
try
MS.LoadFromFile(FileName);
SetString(LoadString, PAnsiChar(MS.Memory), MS.Size);
finally
MS.Free;
end;
Memo.Lines.Add(String(LoadString));
end;
Or TStreamReader:
uses
System.Classes, System.SysUtils;
var
LoadString: String;
Reader: TStreamReader;
begin
Reader := TStreamReader.Create(FileName, TEncoding.ANSI);
try
LoadString := Reader.ReadToEnd;
finally
Reader.Free;
end;
Memo.Lines.Add(LoadString);
end;
Or TFile.ReadAllText():
uses
System.IOUtils, System.SysUtils;
var
LoadString: String;
begin
LoadString := TFile.ReadAllText(FileName, TEncoding.ANSI);
Memo.Lines.Add(LoadString);
end;