|
From: Ramana K. <ra...@my...> - 2002-06-19 12:20:50
|
to start a program using command line arguments, you take these two
arguments in your main function.
example:
---------------------------------
int main(int argc, char *argv[])
{
if(argc == 1)
{
openfile(argv[0]);
}
return 0;
}
---------------------------------
the first argument passed to main (argc) is the number (int) of words typed
after the name of the program when it is run. the second argument is an
array of pointers to char strings, basically, a list in order of all the
words passed to the program when it is run. in your example "bot.exe
level3.bot" argc would equal 1 and argv[0] would evaluate as "level3.bot".
so you could use a function (like openfile(char*) above) or even use
ifstream in(argv[0]); or whatever else your program needs to use the
filename given when your program is run.
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Nils
Langner
Sent: Wednesday, 19 June 2002 2:27 AM
To: dev...@li...
Subject: [Dev-C++] 2 questions
Hi,
can somebody answer me a few questions ? My first problem is
I compiled a console program and want to start it like this "bot.exe
level3.bot"
is it possible to configure dev-c++ o use these parameters ?
my second question concerns the classbrowser, is it possible to
move around in the .cc file or does it only support to move around in
the header ?
yours nils
----------------------------------------------------------------------------
Bringing you mounds of caffeinated joy
>>> http://thinkgeek.com/sf <<<
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|