I'm downloading a file from the web using IdHttp, like this:
var
MS: TMemoryStream;
procedure Test1;
var
Http: TIdHTTP;
begin
Http := TIdHTTP.Create(nil);
try
MS := TMemoryStream.Create;
try
Http.Get('http://www.test.com/test.exe', MS);
finally
MS.Free;
end;
finally
Http.Free;
end;
end;
Consequently, the downloaded file/stream (don't know how to pronounce it) will be in MS.Memory
.
Well, I want to get or convert the MS.Memory
to a string, and vice-versa.
I've tried the functions posted by Rob Kennedy in this question: Converting TMemoryStream to 'String' in Delphi 2009
But I just got the string: "MZP
"
Can anyone help-me?