I have not coded in c in a while, and I never was very good with pointers.
i have this beginning for main.
int main(int argc, char *argv[])
I need to be able to make a copy of the *argv[] in a global scope to allow multiple threads to access it, Is there a fast/easy way to do this?
One way to do it:
This declares a global pointer
prog_argvthat points to yourargv[]array. Note that you also should use a globalprog_argcto be on the safe side (although I think thatargv[argc]is a null pointer (?)).Of course, you need to declare
prog_argvandprog_argcin a header file for the benefit of your other project source files.Some operating system already do something like this for you. The names of the global variables are usually something like
_argvor__argv.