[fpc-devel] Zero terminated strings

Vincent Snijders vsnijders at vodafonevast.nl
Tue Nov 11 08:12:36 CET 2008


ABorka schreef:
> Hi,
> 
> Are strings not zero terminated? I have a function declared:
> 
> function myfunc(s :String; i: Integer):String;
> 
> When going through the string "s" with asm instructions, it does not 
> seem to have a zero byte at the end. Is this normal or something is not 
> OK (maybe now with utf8 strings as defaults it is not there any longer)?

Are you sure that string = ansistring and not string = shortstring. Compile with 
{$mode delphi} (=-MDelphi}, if porting from Delphi, else compile with {$H$} (=-sh).

Vincent



More information about the fpc-devel mailing list