Article View: borland.public.cppbuilder.internet.socket
Article #4598Re: TIdNNTP, string data type and BCB 6
From: Warwick
Date: Mon, 17 Jan 2005 04:26
Date: Mon, 17 Jan 2005 04:26
64 lines
2990 bytes
2990 bytes
Remy Lebeau (TeamB) wrote: > "Warwick" <warwickb1@extradotcodotnz> wrote in message > news:41ea24b0@newsgroups.borland.com... > > >>What is this string datatype? > > > It is exactly what its name suggests - a string of characters. In C++, the > equivilent is the AnsiString class. > > >>TStringList *NewMessages = new TStringList; > > > Why are you creating a TStringList instance that you never actually use? > I didn't really want the data in the Memo component, which I am using for something else. But if I pass NewMessages->Strings as an argument instead the compiler thinks I am passing a single String rather than a TStrings object. I have forgotten how I used to work around that, so I used the Memo->Lines. It is difficult to tell which argument is the one the compiler objects to from the error. As you can see I mistakenly thought it was a difference between AnsiString and string. I thought perhaps because string is a typedef for basic_string in BCB. > >> IdNNTP1->GetNewNewsList( NewsGroups[0], dt , false, >>Distributions, *(Memo1->Lines)); > > > Why are you dereferencing the Memo->Lines pointer? Do not do that. That is > the cause of your error. Use the following code instead: > Ok, thanks. Again I was unsure which argument presented the problem, the pascal definition has all arguments passed by reference. I was experimenting in frustration, originally I did pass it without prefixing it with the dereference operator. > IdNNTP1->GetNewNewsList(NewsGroups[0], dt, false, Distributions, > Memo1->Lines); > > >>I am guessing that AnsiString is not good > > > You guess incorrectly. > > >>I need string. > > > That is exactly what AnsiString is. > > >>Can this component even be used in CBuilder? > > > Yes. > > > Gambit > > Excellent advice. Thanks for your help.
Technical Details
Message-ID:
<41eb3e6d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!easynet-quince!easynet.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41ea24b0@newsgroups.borland.com> <41eacae6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,af8cc131fea57133 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 17 Jan 2005 17:26:04 +1300 From: Warwick <warwickb1@extradotcodotnz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a4) Gecko/20040927 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: TIdNNTP, string data type and BCB 6 References: <41ea24b0@newsgroups.borland.com> <41eacae6$1@newsgroups.borland.com> In-Reply-To: <41eacae6$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 210.86.40.248 Message-ID: <41eb3e6d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1105935981 210.86.40.248 (16 Jan 2005 20:26:21 -0800) Lines: 64 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!easynet-quince!easynet.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail