Re: [fpc-pascal] TStringList/pchar question

2019-06-02 Thread Ryan Joseph
> On Jun 2, 2019, at 2:48 PM, Michael Van Canneyt > wrote: > >> I just learned that pchar is not ref counted like I used to think so I’m >> curious why this code doesn’t fail. Shouldn’t this crash because I free >> TStringList and then access GetText? > > You're first doing gettext and

Re: [fpc-pascal] TStringList/pchar question

2019-06-02 Thread Michael Van Canneyt
On Sun, 2 Jun 2019, Ryan Joseph wrote: I just learned that pchar is not ref counted like I used to think so I’m curious why this code doesn’t fail. Shouldn’t this crash because I free TStringList and then access GetText? You're first doing gettext and then freeing. So this is OK.

[fpc-pascal] TStringList/pchar question

2019-06-02 Thread Ryan Joseph
I just learned that pchar is not ref counted like I used to think so I’m curious why this code doesn’t fail. Shouldn’t this crash because I free TStringList and then access GetText? strings := TStringList.Create; strings.LoadFromFile(vertexShaderPath); vertexShaderSource := strings.GetText;

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-17 Thread el es
On 16/08/17 15:45, Benito van der Zander wrote: > Hi, [sorry I could not stop myself from reordering your top-post] > Am 16.08.2017 um 15:48 schrieb Gabor Boros: >> 2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta: >>> Because the quotes must be the first and last character of each >>>

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Benito van der Zander
Hi, very stupid defaults indeed. I just had a bug last week, because I was using TStringList as map and forgot to change it to case-sensitive Cheers, Benito Am 16.08.2017 um 15:48 schrieb Gabor Boros: 2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta: Because the quotes must be

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Graeme Geldenhuys
On 2017-08-16 14:48, Gabor Boros wrote: SL2.QuoteChar:=#0; solved my problem. But strange if the TStringList think from a starting " the string is quoted. For example if data.cvs contains "abc|89|0 I got the next result with my example program (without QuoteChar trick): 0 * abc|89|0 Try using

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Gabor Boros
2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta: Because the quotes must be the first and last character of each string (or "cell"). As noted in another reply, set the quote character to something unused, and it will disable (or circumvent) quoting altogether. SL2.QuoteChar:=#0;

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Gabor Boros
2017. 08. 16. 15:15 keltezéssel, Kevin Jesshope írta: Setting the quotechar to something impossible (linefeed, #0 etc) stops the quote processing. SL2.QuoteChar:=#0; solved my problem. Thank you! Gabor ___ fpc-pascal maillist -

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Michael Van Canneyt
On Wed, 16 Aug 2017, Gabor Boros wrote: Hi All, With the attached example program and data.csv I got the next result: 0 * 84392 1 * asfds 2 * hytr 3 * 43421454 4 * O 5 * fdsfds 6 * 654645645 "O" fdsfsd 7 * hgfgfedw 8 * fg 9 * 321.544 10 * 89 11 * 0 "O" fdsfds - broken into two parts

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Kevin Jesshope
Setting the quotechar to something impossible (linefeed, #0 etc) stops the quote processing. SL2.QuoteChar:=#10; results in 0 * 84392 1 * asfds 2 * hytr 3 * 43421454 4 * "O" fdsfds 5 * 654645645 "O" fdsfsd 6 * hgfgfedw 7 * fg 8 * 321.544 9 * 89 10 * 0 Regards Kevin Jesshope - In Touch

[fpc-pascal] TStringList - Strange quotation mark handling

2017-08-16 Thread Gabor Boros
Hi All, With the attached example program and data.csv I got the next result: 0 * 84392 1 * asfds 2 * hytr 3 * 43421454 4 * O 5 * fdsfds 6 * 654645645 "O" fdsfsd 7 * hgfgfedw 8 * fg 9 * 321.544 10 * 89 11 * 0 "O" fdsfds - broken into two parts which is bad from my POV. See 4 * O and 5 *

Re: [fpc-pascal] TStringList bug?

2010-04-08 Thread Michael Van Canneyt
On Wed, 7 Apr 2010, Michael Müller wrote: Hi, the following code behaves different between Delphi and Free Pascal: {$APPTYPE CONSOLE} {$IFDEF FPC} {$MODE delphi} {$ENDIF} uses Classes; type TFoo = class(TStringList) public constructor Create; end; constructor TFoo.Create; begin

[fpc-pascal] TStringList bug?

2010-04-07 Thread Michael Müller
Hi, the following code behaves different between Delphi and Free Pascal: {$APPTYPE CONSOLE} {$IFDEF FPC} {$MODE delphi} {$ENDIF} uses Classes; type TFoo = class(TStringList) public constructor Create; end; constructor TFoo.Create; begin inherited Create; {$IFDEF FPC} // Is needed by

[fpc-pascal] TStringList

2008-01-14 Thread Damien Gerard
I often use TObjectLis, which is able to destroy by itself objects in its list. However, is it the same with a TStringList when an object is added with AddObject ? I mean when the method .Clear or Delete are called, is my associated object is destroyed in the same time ? I suppose there

Re: [fpc-pascal] TStringList

2008-01-14 Thread Michael Van Canneyt
On Mon, 14 Jan 2008, Damien Gerard wrote: I often use TObjectLis, which is able to destroy by itself objects in its list. However, is it the same with a TStringList when an object is added with AddObject ? No. I mean when the method .Clear or Delete are called, is my associated

[fpc-pascal] TStringList Bug?

2006-09-26 Thread Jeremy Cowgar
Below is a simple program that I *think* is working wrong. I am new to Pascal, so I may very well be doing something wrong. Can anyone comment? Jeremy program stringlistbug; uses Classes; var SL : TStringList; begin SL := TStringList.Create;

Re: [fpc-pascal] TStringList Bug?

2006-09-26 Thread Michael Van Canneyt
On Tue, 26 Sep 2006, Jeremy Cowgar wrote: Below is a simple program that I *think* is working wrong. I am new to Pascal, so I may very well be doing something wrong. Can anyone comment? Space is always a delimiter. You should use SL.DelimitedText := 'Hello World|How are you doing?';

Re: [fpc-pascal] TStringList Bug?

2006-09-26 Thread Jeremy Cowgar
I was hoping to use it to parse a pipe delimited file. This will not work as I do not want chars as part of the result, I'd have to add it in, then subtract them out. That's kind of weird behavior that a delimiter would be forced (space) even when the delimiter field is set. Thanks for

Re: [fpc-pascal] TStringList Bug?

2006-09-26 Thread Graeme Geldenhuys
On 26/09/06, Jeremy Cowgar [EMAIL PROTECTED] wrote: Thanks for the info though, I'll figure another way. Jeremy Try the following approach: -- function tiNumToken(const pStrValue, pStrToken : string) : integer; var i, iCount : integer; lsValue :

[fpc-pascal]TStringList memory usage

2004-05-29 Thread Marc Santhoff
Hi! How can i query the real memory consumption of a filled TStringList? Lately I watched 200 stringlists containing approx. 12 String of differing lengths (12kByte as CSV on disk) more than 70 MBs ... TIA, Marc ___ fpc-pascal maillist - [EMAIL

[fpc-pascal]TStringList index

2004-03-14 Thread Taj Morton
Hi all, This code has been driving me nuts for the past week. IDs:=TStringList.Create; for i:=0 to Datab.List_Field.Count-1 do begin Tmp:=TStringList(Datab.List_Field.items[i]); IDs.Strings[i]:=Tmp.Strings[0]; Tmp.Free; end; It crashes with An

Re: [fpc-pascal]TStringList index

2004-03-14 Thread Taj Morton
Hi Vincent, Instead do: IDs.Add(Tmp.Strings[0]); Aha! Thank you! --Taj -- panic: kernel trap (ignored) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal

RE: [fpc-pascal]TStringList index

2004-03-14 Thread Jesus Reyes
- Original Message - From: Taj Morton [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 14, 2004 1:04 PM Subject: [fpc-pascal]TStringList index Hi all, This code has been driving me nuts for the past week. IDs:=TStringList.Create; for i:=0