|
From: Nils L. <lan...@we...> - 2002-06-18 16:27:05
|
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 |
|
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
|
|
From: Mac R. <re...@no...> - 2002-06-19 16:49:13
|
I'm a little disturbed by the description given below. I'm pretty sure
that argc includes the name of the executable, so that "bot.exe level3.bot"
would have argc == 2. I know that argv[0] contains the name of the
executable, because UN*X systems use this to distinguish behaviors for
symlinked executables (don't ask, it isn't possible on Windows, and it is
slightly odd anyway). The practical upshot is that, for the example above,
argv[0] would be "bot.exe" and argv[1] would be "level3.bot".
At 10:19 PM 6/19/02 +1000, Ramana Kumar wrote:
>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
>
>
>
>
>----------------------------------------------------------------------------
> 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
>
-
_____________________________ /"\
Mac Reiter \ / ASCII Ribbon Campaign
Nomadics, Inc. X Against HTML Mail
re...@no... / \ (To join the campaign, simply use
this in your signature.)
|
|
From: Hongli L. <h....@ch...> - 2002-06-19 19:48:49
|
On Wed, 2002-06-19 at 18:47, Mac Reiter wrote: > I'm a little disturbed by the description given below. I'm pretty sure > that argc includes the name of the executable, so that "bot.exe level3.bot" > would have argc == 2. I know that argv[0] contains the name of the > executable, because UN*X systems use this to distinguish behaviors for > symlinked executables (don't ask, it isn't possible on Windows, and it is > slightly odd anyway). The practical upshot is that, for the example above, > argv[0] would be "bot.exe" and argv[1] would be "level3.bot". > Actually, argv[0] is always the full filename of the executable, like C:\Foo\Bar.exe, no matter what you do. In Unix, argv[0] is what you've typed in at the commandline, not the filename of the executable. |
|
From: Ioannis V. <no...@ho...> - 2002-06-19 20:48:38
|
Yes, if the mechanism work. There is a possibility the program to not
"see" the arguments and argc to be 0. Also if it works, argv[0] can be
"" (which is '\0' and 0).
The C++ standard says:
"An implementation shall not predefine the main function. This function
shall not be overloaded. It shall
have a return type of type int, but otherwise its type is
implementationdefined.
All implementations
shall allow both of the following definitions of main:
int main() { /* ... */ }
and
int main(int argc, char* argv[]) { /* ... */ }
In the latter form argc shall be the number of arguments passed to the
program from the environment in
which the program is run. If argc is nonzero these arguments shall be
supplied in argv[0] through
argv[argc1] as pointers to the initial characters of nullterminated
multibyte strings (NTMBSs)
(17.3.2.1.3.2) and argv[0] shall be the pointer to the initial character
of a NTMBS that represents the
name used to invoke the program or "". The value of argc shall be
nonnegative. The value of
argv[argc] shall be 0. [Note: it is recommended that any further
(optional) parameters be added after
argv. ]"
Ioannis
* Ioannis Vranos
* Programming pages: <http://www.noicys.cjb.net>
http://www.noicys.cjb.net
* Alternative URL: <http://run.to/noicys> http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [ <mailto:dev...@li...>
mailto:dev...@li...] On Behalf
> Of Mac Reiter
> Sent: Wednesday, June 19, 2002 7:47 PM
> To: C++
> Subject: RE: [Dev-C++] 2 questions
>
>
> I'm a little disturbed by the description given below. I'm
> pretty sure
> that argc includes the name of the executable, so that
> "bot.exe level3.bot"
> would have argc == 2. I know that argv[0] contains the name of the
> executable, because UN*X systems use this to distinguish behaviors for
> symlinked executables (don't ask, it isn't possible on
> Windows, and it is
> slightly odd anyway). The practical upshot is that, for the
> example above,
> argv[0] would be "bot.exe" and argv[1] would be "level3.bot".
|
|
From: Ramana K. <ra...@my...> - 2002-06-20 13:15:43
|
thanks very much
i would have been a little disturbed too. i am not too familiar with the
workings of command line arguments and was just copying a bit out of a text
book.
thanks for correcting me
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Mac
Reiter
Sent: Thursday, 20 June 2002 2:47 AM
To: C++
Subject: RE: [Dev-C++] 2 questions
I'm a little disturbed by the description given below. I'm pretty sure
that argc includes the name of the executable, so that "bot.exe level3.bot"
would have argc == 2. I know that argv[0] contains the name of the
executable, because UN*X systems use this to distinguish behaviors for
symlinked executables (don't ask, it isn't possible on Windows, and it is
slightly odd anyway). The practical upshot is that, for the example above,
argv[0] would be "bot.exe" and argv[1] would be "level3.bot".
At 10:19 PM 6/19/02 +1000, Ramana Kumar wrote:
>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
>
>
>
>
>---------------------------------------------------------------------------
-
> 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
>
-
_____________________________ /"\
Mac Reiter \ / ASCII Ribbon Campaign
Nomadics, Inc. X Against HTML Mail
re...@no... / \ (To join the campaign, simply use
this in your signature.)
----------------------------------------------------------------------------
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
|
|
From: Andres R. <lo...@ho...> - 2002-06-19 22:03:37
|
See.. Original qustion wosn't about how to code it, but how to use it on Dev-C++ IDE!! I have same question about IDE. Read carefully!! A. > 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 P.S. Sry for HTML.. it's just for clearifying the point here.. |
|
From: Ramana K. <ra...@my...> - 2002-06-20 13:13:56
|
surely info on the dev-c++ ide is not needed when you can solve your problems with actual code... oh wait a second... do you mean starting dev-c++ with command line arguments? for that i think you would need to wait for a new version where it is implemented and at the moment, argue strongly why we would need such a thing -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Andres Rand Sent: Thursday, 20 June 2002 8:04 AM To: Dev-C++ users Subject: RE: [Dev-C++] 2 questions See.. Original qustion wosn't about how to code it, but how to use it on Dev-C++ IDE!! I have same question about IDE. Read carefully!! A. > 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 P.S. Sry for HTML.. it's just for clearifying the point here.. |
|
From: Bob W. <bo...@ph...> - 2002-06-20 16:22:18
|
If you mean that you want to pass a parameter to a program you have compiled with dev-c++ when you run the freshly compiled program still in the IDE, go to "Options>Enviroment Options>Preferences" and you will see an input box labled "Give the following parameters when executing a compiled project". Use this to call your program with parameters, in case it needs some. Regards, Bob Wilson > > 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 |
|
From: Mac R. <re...@no...> - 2002-06-20 14:28:34
|
At 01:03 AM 6/20/02 +0300, Andres Rand wrote:
> See.. Original qustion wosn't about how to code it, but how to use
>it on Dev-C++ IDE!! I have same question about IDE. Read carefully!!
> A. > Hi, > > can somebody answer me a few questions ? My first
>problem is >"bot.exe >" > 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 P.S. Sry for HTML..
>it’s just for clearifying the point here..
OK, I'm going to go out on a limb here. The only interpretation I can
place on your question that makes any sense to me in the context of an IDE
(Dev-C++ or any other IDE) is:
"How do I configure the debugging system to pass command line arguments to
the program I am developing?"
Is this a correct interpretation? If not, could you please be more
specific about what you are wanting to do and what is keeping you from
doing it?
Mac
-
_____________________________ /"\
Mac Reiter \ / ASCII Ribbon Campaign
Nomadics, Inc. X Against HTML Mail
re...@no... / \ (To join the campaign, simply use
this in your signature.)
|