On Thu, 11 Feb 2010 21:53:59 +0100 Rainer Stratmann <rainerstratm...@t-online.de> wrote:
> Am Thursday 11 February 2010 21:24:03 schrieb Ralf A. Quint: > > At 12:07 PM 2/11/2010, Jonas Maebe wrote: > > >On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: > > >>In the past with the turbopascal compiler and other always sizeof > > >>byte was > > >>added. > > > > > >That is not true. This program prints "2" when compiled under Turbo > > >Pascal: > > > > I am fairly certain that he confuses this with the special case of > > applying sizeof() to a string type, where you always get one byte > > more (the preceding length byte) than the string type has been > > defined, for example SizeOf (String [80]) will return 81, 80 bytes > > reserved for the contents plus the length byte... > > > > Ralf > > How can I have access to position 4 of a pointer? > > var > p : pbyte; > c : char; > s : ansistring; > x : longint; > > ... > > s := 'Hello'; > p := @s; Now p is an PAnsiString. Maybe you meant: p:=PByte(s); > x := 4; // 4th position > > c := [p+x]^ ??? how to get access to the 'o' c:=chr(p[x]); But normally you use PChar: var p: PChar; ... p:=s; c:=p[x]; Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal