[fpc-pascal] Bending System.IndexByte to my will!!?

Reinier Olislagers reinierolislagers at gmail.com
Thu Apr 18 08:18:29 CEST 2013

On 18-4-2013 8:14, Jeppe Græsdal Johansen wrote:
> Den 18-04-2013 07:57, Reinier Olislagers skrev:
>> In fcl-db\src\dbase\dbf_common.pas we find this part used to e.g. find
>> end of file ($1A/ASCII 26) markers in a buffer with memo data: [1]
>> The problem is: the first MemScan function doesn't work:
>> System.IndexByte just always return -1 even if the character is there.
>> Tried system.indexbyte with a simple test program and of course it
>> worked.
>> If I comment out $ifdef fpc to force use of the second function, the $1A
>> is found perfectly.
>> Where lies the problem?
> Since you have a typed const pointer instead of an untyped const
> parameter, you need to do this:
> System.IndexByte(PByte(Buffer)^, Length, Chr);

Thanks a lot, that works beautifully!

More information about the fpc-pascal mailing list