Newbie problem with **argv

V

Vio

I want to call this function, whose prototype is:

extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv);

I want to ignore both arguments essenially. My problem is with **argv.
In C this is called a handle to a struct. In C++ I don't know. But
mostly I suck at pointers, messing these up.
So, my question is: How do I initialize **argv in my call?
Things like following don't seem to work:

wxEntryStart(int argc=0, char *argv[]=NULL);
My choice:
wxEntryStart(0, NULL);

or:
char *argv[];//=";";
argv[0]=" ";
bool wxEntryStart(int argc=0, *argv);//wxEntryStart(int& argc, wxChar
**argv)

b1.cpp:142: ANSI C++ forbids declaration `argv' with no type
b1.cpp:142: conflicting types for `int argv[0]'
b1.cpp:141: previous declaration as `char * argv[]'
b1.cpp:142: invalid initializer
b1.cpp:143: type specifier omitted for parameter
make: *** [b1.o] Error 1


Much obliged for your help,
Vio
 
R

Rolf Magnus

Vio said:
I want to call this function, whose prototype is:

extern bool WXDLLIMPEXP_BASE wxEntryStart(int& argc, wxChar **argv);

I want to ignore both arguments essenially. My problem is with **argv.
In C this is called a handle to a struct.

There is no such thing as 'handle' in standard C. argv is a pointer to
pointer to wxChar, **argv is a wxChar.
In C++ I don't know.

It's the same as in C.
But mostly I suck at pointers, messing these up.
So, my question is: How do I initialize **argv in my call?
Things like following don't seem to work:

wxEntryStart(int argc=0, char *argv[]=NULL);
My choice:
wxEntryStart(0, NULL);

This should work, though:

wxEntryStart();

would be enough. That's why you gave default values for your parameters
in the first place.
or:
char *argv[];//=";";

The above line is illegal, because you can't define arrays that have no
size.
argv[0]=" ";

For this, the argv array would at least have to have one element.
bool wxEntryStart(int argc=0, *argv);

This isn't a valid function call. Make it soemthing like:

bool ret = wxEntryStart(0, argv);

*argv would be a pointer to char, but you have to supply argv itself,
which is a pointer to pointer to char.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top