[DUG] Indy
Max Nilson
max at accredo.co.nz
Thu Aug 3 19:08:24 NZST 2006
Robert martin asked:
> On the FTP server I have
>
> procedure TForm1.IdFTPServerCRCFile(ASender: TIdFTPServerContext;
> const AFileName: String; var VStream: TStream); var
> CRC : TIdHashCRC32;
> fs : TFileStream;
> Hash : String;
> begin
> CRC := TIdHashCRC32.Create;
> try
> fs := TFileStream.Create(AFilename, fmOpenRead);
> try
> Hash := IntToStr(CRC.HashValue(fs));
>
> VStream := TMemoryStream.Create;
> VStream.Write(Hash, SizeOf(Hash));
I think the preceeding line should read:
VStream.Write(Hash, Length(Hash));
As SizeOf will return you 4 bytes being the native size of the string type,
ie. a pointer.
> finally
> fs.Free;
> end;
> finally
> CRC.Free;
> end;
Cheers, Max.
More information about the Delphi
mailing list