Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread ik
On Mon, Dec 3, 2012 at 1:00 PM, Michael Van Canneyt wrote: > > > On Mon, 3 Dec 2012, Jonas Maebe wrote: > >> >> On 03 Dec 2012, at 11:52, Michael Van Canneyt wrote: >> >>> On Mon, 3 Dec 2012, Jonas Maebe wrote: >>> On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote: > You are overwr

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread Michael Van Canneyt
On Mon, 3 Dec 2012, Jonas Maebe wrote: On 03 Dec 2012, at 11:52, Michael Van Canneyt wrote: On Mon, 3 Dec 2012, Jonas Maebe wrote: On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote: You are overwriting the pointer. S is (behind the scenes) a pointer to a memory area. You should do Fil

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread Jonas Maebe
On 03 Dec 2012, at 11:52, Michael Van Canneyt wrote: On Mon, 3 Dec 2012, Jonas Maebe wrote: On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote: You are overwriting the pointer. S is (behind the scenes) a pointer to a memory area. You should do FillChar(s[1], 1024, '*'); Or use http://ww

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread Michael Van Canneyt
On Mon, 3 Dec 2012, Jonas Maebe wrote: On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote: On Mon, 3 Dec 2012, ik wrote: var s : AnsiString; l : word; begin SetLength(s, 1024); FillChar(s, 1024, '*'); You are overwriting the pointer. S is (behind the scenes) a pointer to a memory are

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread Jonas Maebe
On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote: On Mon, 3 Dec 2012, ik wrote: var s : AnsiString; l : word; begin SetLength(s, 1024); FillChar(s, 1024, '*'); You are overwriting the pointer. S is (behind the scenes) a pointer to a memory area. You should do FillChar(s[1], 1024, '*')

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread ik
On Mon, Dec 3, 2012 at 12:13 PM, Michael Van Canneyt wrote: > > > On Mon, 3 Dec 2012, ik wrote: > >> Hello, >> >> When I try to get the length of AnsiString, it returns me segment fault. >> I'm not sure if I'm doing something wrong: >> >> var >> s : AnsiString; >> l : word; >> >> begin >> SetLe

Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread Michael Van Canneyt
On Mon, 3 Dec 2012, ik wrote: Hello, When I try to get the length of AnsiString, it returns me segment fault. I'm not sure if I'm doing something wrong: var s : AnsiString; l : word; begin SetLength(s, 1024); FillChar(s, 1024, '*'); You are overwriting the pointer. S is (behind the sc

[fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread ik
Hello, When I try to get the length of AnsiString, it returns me segment fault. I'm not sure if I'm doing something wrong: var s : AnsiString; l : word; begin SetLength(s, 1024); FillChar(s, 1024, '*'); l := Length(s); // seg fault here writeln(l); end. Am I doing here something wro