>>PKZip has a nice feature that generates a 32-bit checksum of each file in the archive, in order to ensure data integrity.
>>
>>Can anyone outline how to generate one in VFP for an arbitrary file, or point me to a reference?
>
>You could use SYS(2007) after using FILETOSTR() to grab the file content; it is not the same checksum algorithm, yielding a 16 bit value, but it's free and quick:
>
>nCheckSum = SYS(2007,FILETOSTR(cFileToCheckSum))
Thanks for pointing out the breadth and depth of VFP! I never dreamed a database language would include such a low-level function.
OTOH I'm using VFP5, with no FILETOSTR(); I guess I'll have to set up a temporary cursor with a binary memo field, and run SYS(2007) against that.
A 16-bit checksum might be good enough for my purpose; if I understand it correctly, another nonidentical file will have the same 16-bit checksum on average only once every 2^16, or 65536 times.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up