Delphi 2007:
Code:
type
TMyRecord = packed record
name: string[255];
someint: int64;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
s : tmyrecord;
begin
fillchar(s,sizeof(tmyrecord),$80); //fill with non-zero for testing
s.name := '12'#0'34';
self.caption := inttostr(length(s.name)); //set breakpoint here
end;
The window caption will display the length of the string as 5. If you set a breakpoint where selected and press ctrl-f7 for evaluate and type "s,m" you will see a hex dump of the "s" variable. You will see that there is no zero after the string.
Bookmarks