Using argv argc

I searched on the forums. No advises.
I am using a previous source code. I changed the main function main(int argc, char **argv) in a function misc(int argc, char **argv). How do you use the argc and argv parameters? This is how I am calling the function :
char param[100];
strcat(param,"wgrib ");
strcat(param,location);
strcat(param," -d 0 -text -o dumpX");
ptr1 = param;
ptr2 = &ptr1;
wgrib(7, ptr2);

wgrib (int argc, char **argv) {....

Can someone help me? Segmentation fault :o

Thanks

Could you try changing **argv (pointer to pointer ) to
*argv[] ( pointer to an array).

I replaced **argv by *argv[]

Doesn't seem to work :o
char location[100],param[150],*ptr1,**ptr2;

Location is the path of the brib file;

strcat(param,"wgrib ");
strcat(param,location);
strcat(param," -V");
ptr1 = param;
ptr2 = &ptr1;
wgrib(2, ptr2);

With the above code, using the strcat function, ptr2[0] = "..." , ptr2[1] is set to "null", etc... I have just found my error. I must "send" my params as an ARRAY :stuck_out_tongue: .
Here is my new code, working well :

char param[150],location[100],*ptr,**ptrptr;
ptr = param;
ptrptr = &ptr;
ptrptr[0] = "wgrib";
ptrptr[1] = location;
ptrptr[2] = "-d";
ptrptr[3] = "0";
ptrptr[4] = "-text";
wgrib(5, ptrptr);

with int wgrib(int argc, char *argv[]) (or int wgrib(int argc, char **argv))

Thanks :smiley:

char *param[]={"wgrib","","-s","-p","0","-text","-o",""},location[100];

...
param[1] = Finder();
param[7]="dumpX";
wgrib(8, param);
...

:rolleyes: