Ben Bacarisse wrote:
> Hal Vaughan <hal@[EMAIL PROTECTED]
> writes:
>
>> Hal Vaughan wrote:
>>
>>> Hal Vaughan wrote:
>> ...
>>> There's one problem that didn't show up until I fixed this one.
>>>
>>> I have my own library with this function:
>>>
>>> void parseargs(int, char*);
>
> This declaration does not match the definition you give later.
Okay. I'm a bit confused. I have:
int main(int argc, char* argv[])
which leads me to believe argv is of type char*, so when I call
parseargs(argc, argv)
I would expect parseargs to have the same signature as far as the params
go:
map<string,string> parseargs(int count, char* args[])
From what you say, it should be:
map<string,string> parseargs(int count, char** args[])
Why the difference? And why is it that when I had it the first way, it
was
working before?
And when I was reading the args in main(), I could do this:
string arg;
arg = argv[x]
as long as x was less than argc, but when I pass argv on to parseargs(), I
can't do the same thing. So am I passing it incorrectly as a parameter to
parseargs() or am I doing something wrong by trying to read it that way in
a different function? How can I pass argv to a different function so that
function can parse it? I'm building up my own library and I want this
function to be something I can reuse in later programs.
Thanks!
Hal


|