[fpc-devel] StrPos giving a access violation

Graeme Geldenhuys graeme at mastermaths.co.za
Mon Dec 12 13:18:55 CET 2005

Jonas Maebe wrote:

>> Is that not also undocumented behaviour ?
> I'm quite sure it isn't: afaik typecasting an ansistring to a pchar  is 
> fully supported. This means that an empty ansistring must result  in an 
> empty (as opposed to an invalid) pchar.

Taken from Delphi 7 help:

Mixing Delphi strings and null-terminated strings

* You can also use Pointer(S) to cast a long string to an untyped 
pointer. But if S is empty, the typecast returns nil.
* PChar(S) always returns a pointer to a memory block; if S is empty, a 
pointer to #0 is returned.

   - Graeme -

More information about the fpc-devel mailing list