Routine returning multiples of 65536
Posted on 1998-08-13
here's a strange one: I'm using this sort routine from a 3rd party vendor. It's in the form of a DLL...one of its parameters is a LONGINT which returns back to the calling program the final number of sorted records output. I was instructed to put a VAR in front of the parameter when I call this DLL.
When I call the DLL when sorting a file...it sorts the file correctly, but always returns a crazy number in this recnum count field. And it always seems to be in multiples of 65536! If my input file has less than 65536 records, it'll return 0...if it has between 65536 and 131072, it'll return 65536...weird!
I tried asking the people who make this sort routine, but they're idiots and they couldn't give me an answer. All they said is that it looks like the low order byte is being taken as the high order byte and so on. But didn't provide a solution. If this is in fact the case, is there a way to flip the bytes around in this longint field to yield the correct answer?