Re: main(int argc, char *argv[])
- From: "David Resnick" <lndresnick@xxxxxxxxx>
- Date: 29 Apr 2005 06:33:51 -0700
Sokar wrote:
> I have my main function set up as
>
> int main(int argv, char *argv[])
>
> so taht i can read in a variable which is passed to the program on
the
> command line. The problem is that main calls other functions and
some
> of them need to start jump to the start of main. If my main setup
was
> just int main() this would be no problem, i could just call main();
>
> The problem is main needs parameters passed to it now. Would any1
> know what parameters I could pass to vall the main program??
>
> argv[1] is just used once as soon as main starts up and never used
> again after, so i dont mind if i loose the ability to read from it, i
> just need to be able to call main from another part of the program
>
> Thanks and regards
Recursively calling main is a bit funky. Why not have main call some
other
function (which takes no arguments) which is then used for the
recursion?
Anyway, you could always call main later with main(0,NULL).
Or if you want, you could squirrel away (in a static) the original
argc and argv and reinvoke main with them later.
-David
.
- Follow-Ups:
- Re: main(int argc, char *argv[])
- From: Michael Mair
- Re: main(int argc, char *argv[])
- References:
- main(int argc, char *argv[])
- From: Sokar
- main(int argc, char *argv[])
- Prev by Date: main(int argc, char *argv[])
- Next by Date: Re: main(int argc, char *argv[])
- Previous by thread: main(int argc, char *argv[])
- Next by thread: Re: main(int argc, char *argv[])
- Index(es):
Relevant Pages
|