🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14590

Re: wchar_t**

#14590
From: Andrue Cope
Date: Fri, 08 Aug 2003 09:02
43 lines
2252 bytes
Maurice Anderson,

> What is char**.   I know char* is a pointer but what is the extra "*" for?
>

Same answer as before. 'char**' is a pointer to a pointer to a 'char'.

It's the low level way of describing an array of 'char *'. It's not needed 
often but it is needed when you want to store a pointer to an array of 'char 
*' eg:

  char * StringArray[ 500 ];
  
That's fine but if you need to just store a pointer to that array it becomes 
tricky. You can't just do:

  char * tempPtr[ 500 ]=StringArray;

Because that attempts to create another 500 element array and assign one to 
the other.

When declaring a function to take such an array you can do:

  void wibble( char * arg1[] );
  ...
  wibble( StringArray );

But you can't do that in actual code:

  char * tempPtr[]=StringArray;

Because then you are trying to create an array of unknown size and assign 
one to the other, doubly illegal.

The solution (suggested by the compiler error messages is):

  BYTE **srcBuffers=StringArray;

Always remember that '[]' is just a handy human readable alternative to 
pointer notation.
--
Andrue Cope
[Bicester, UK]
Technical Details
Message-ID: <VA.00001e96.0a936aed@email.address.sorry>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f3340e1$1@newsgroups.borland.com> <oprtkq1wb9ksrh3r@newsgroups.borland.com> <3f334c96@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,957a1a08778b0a57
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-08 02:09:49 PST
Date: Fri, 08 Aug 2003 10:02:40 +0100
Newsgroups: borland.public.cppbuilder.nativeapi
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va
Message-ID: <VA.00001e96.0a936aed@email.address.sorry>
Subject: Re: wchar_t**
From: Andrue Cope <not.a.valid@email.address.sorry>
Reply-To: not.a.valid@email.address.sorry
References: <3f3340e1$1@newsgroups.borland.com> <oprtkq1wb9ksrh3r@newsgroups.borland.com> <3f334c96@newsgroups.borland.com>
NNTP-Posting-Host: 217.207.223.34
X-Trace: newsgroups.borland.com 1060333428 217.207.223.34 (8 Aug 2003 02:03:48 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail