Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: const char * const *argv ??

Reply
Thread Tools

Re: const char * const *argv ??

 
 
Peter van Merkerk
Guest
Posts: n/a
 
      08-30-2003
> bool __stdcall preproc(const char *user, int type, const char * const
*argv,
> int argc)
>
> the bit im interested in is the
>
> const char * const *argv


That is a pointer pointing to constant-pointer pointing to const-char. Are
you still there?

It means that:
1. the argv pointer cannot change the value of the pointer it is pointing
to; *argv = 0 is not allowed.
2. the characters cannot be changed via this pointer to a pointer; **argv =
'a' is not allowed.

> iv never seen somthing decleared like this before and wonder if some one
> could explain it to me plz ?? i have a bit more info on it as follows.
> It looks like its an array because argv[0] contains a string and argv[1]
> also contains a string.


You are correct.

> if this is the case how was it made an array and is
> there a way i could find out the size of it.


Unfortunately there if no standard way to derive that information from argv
itself. Maybe that size of the array can be derived from other parameters or
maybe argv[last] == 0. You will have to ask the one who wrote that code I'm
affraid.

Note that in C++ this problem of passing a variable number of strings can be
solved much more elegantly with the help of the std::vector and the
std::string class.
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
(const char *cp) and (char *p) are consistent type, (const char **cpp) and (char **pp) are not consistent lovecreatesbeauty C Programming 1 05-09-2006 08:01 AM
Is char** (or char*[]) implicitly convertible to 'const char * const *'? kevin.hall@motioneng.com C Programming 24 10-30-2005 08:07 AM
extern const char * vs. extern const char []http://tinyurl.com/47e3k Thomas Matthews C++ 5 08-02-2004 10:36 AM
Exact difference between 'const char *' and 'char *', also diff between 'const' and 'static' Santa C Programming 1 07-17-2003 02:10 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57