469,631 Members | 1,173 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

I Need help with a command

I want to run a program from the program im writing. For example when
my program is running I want it to open up an internet explorer window.
I have been searching and found that there is a RUN command, it won't
run with any library that I know. so what i am asking for is a way to
call other programs, or the header file nescarrary to use the RUN
command.

Jul 23 '05 #1
10 3596
sa***********@gmail.com wrote:
I want to run a program from the program im writing. For example when
my program is running I want it to open up an internet explorer
window. I have been searching and found that there is a RUN command,
it won't run with any library that I know. so what i am asking for
is a way to call other programs, or the header file nescarrary to use
the RUN command.


Post this to 'comp.os.ms-windows.programmer.win32'. They will help you
with available means of starting another process in Windows.

V
Jul 23 '05 #2
Victor Bazarov wrote:
sa***********@gmail.com wrote:
I want to run a program from the program im writing. For example when
my program is running I want it to open up an internet explorer
window. I have been searching and found that there is a RUN command,
it won't run with any library that I know. so what i am asking for
is a way to call other programs, or the header file nescarrary to use
the RUN command.

Post this to 'comp.os.ms-windows.programmer.win32'. They will help you
with available means of starting another process in Windows.

V


The system(const char *) function is available in cstdlib. Look at the
following code:

ken@ken-wn0vf73qmks ~/c
$ cat run.cpp
#include <cstdlib>
#include <cstdio>

int main(int argc, char **argv) {
if(argc == 2) system(argv[1]);
else printf("Usage: %s [program-name]\n", argv[0]);
return 0;
}

ken@ken-wn0vf73qmks ~/c
$ ./run ./test
1: Hello!, 2: Hello!, 3: Hello!
Hi12345, Hello!
Jul 23 '05 #3

"Ken Human" <ke******@comcast.net> wrote in message
news:fN********************@comcast.com...
Victor Bazarov wrote:
sa***********@gmail.com wrote:
I want to run a program from the program im writing. For example when
my program is running I want it to open up an internet explorer
window. I have been searching and found that there is a RUN command,
it won't run with any library that I know. so what i am asking for
is a way to call other programs, or the header file nescarrary to use
the RUN command.

Post this to 'comp.os.ms-windows.programmer.win32'. They will help you
with available means of starting another process in Windows.

V


The system(const char *) function is available in cstdlib. Look at the
following code:


Its not a function, its a macro and its not c++ either. So you are off
topic.

Redirecting the OP to the appropriate newsgroup is beneficial for both the
users here and the OP. For example, in this specific case, cstdlib's system
macro isn't the recommended way to launch that application and the
executable in question is not found in the windows environment path.

ken@ken-wn0vf73qmks ~/c
$ cat run.cpp
#include <cstdlib>
#include <cstdio>

int main(int argc, char **argv) {
if(argc == 2) system(argv[1]);
else printf("Usage: %s [program-name]\n", argv[0]);
return 0;
}

ken@ken-wn0vf73qmks ~/c
$ ./run ./test
1: Hello!, 2: Hello!, 3: Hello!
Hi12345, Hello!

Jul 23 '05 #4
codigo wrote:
"Ken Human" <ke******@comcast.net> wrote in message
news:fN********************@comcast.com...
Victor Bazarov wrote:
sa***********@gmail.com wrote:
I want to run a program from the program im writing. For example when
my program is running I want it to open up an internet explorer
window. I have been searching and found that there is a RUN command,
it won't run with any library that I know. so what i am asking for
is a way to call other programs, or the header file nescarrary to use
the RUN command.
Post this to 'comp.os.ms-windows.programmer.win32'. They will help you
with available means of starting another process in Windows.

V
The system(const char *) function is available in cstdlib. Look at the
following code:

Its not a function, its a macro


Cygwin declares system as:
#define _EXFUN(name, proto) __cdecl name proto
int _EXFUN(system,(const char *__string));

The latest MSVS.NET declares it as:
_CRTIMP int __cdecl system(const char *);

Those are some odd looking macros. If you're interested in the
definitions for these functions, I can accommodate.

and its not c++ either. So you are off topic.

Last I checked, cstdlib was a standard C++ header.

Redirecting the OP to the appropriate newsgroup is beneficial for both the
users here and the OP. For example, in this specific case, cstdlib's system
macro isn't the recommended way to launch that application and the
executable in question is not found in the windows environment path.


Redirecting the OP didn't answer his question. He was asking about a
RUN() function and was most likely talking about system().
Jul 23 '05 #5
Ken Human wrote:
Redirecting the OP didn't answer his question. He was asking about a
RUN() function and was most likely talking about system().


If it is not standard c++ language, then redirecting to proper newsgroup
is much better response. He is likely to get more correct answer from
that 'dedicated' group.

Krishanu

Jul 23 '05 #6
codigo wrote:
Its not a function, its a macro and its not c++ either. So you are off
topic.

From C90 which applies in C++98 too:

4.10.4.5 The system function

Synopsis

#include <stdlib.h>
int system(const char *string);

Description

The system function passes the string pointed to by string to the host environment to be
executed by a command processor in an implementation-defined manner. A null pointer may be
used for string to inquire whether a command processor exists.

Returns

If the argument is a null pointer, the system function returns nonzero only if a command
processor is available. If the argument is not a null pointer, the system function returns
an implementation-defined value."
In other words it is not a macro.
For example, in this specific case, cstdlib's system
macro
function

isn't the recommended way to launch that application
Why?

and the
executable in question is not found in the windows environment path.

Are you talking about Internet Explorer?
--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #7
Krishanu Debnath wrote:
Ken Human wrote:
Redirecting the OP didn't answer his question. He was asking about a
RUN() function and was most likely talking about system().

If it is not standard c++ language, then redirecting to proper newsgroup
is much better response. He is likely to get more correct answer from
that 'dedicated' group.

Krishanu


Check your standard. App 3.2.7. It clearly claims system() as a
standard C++ function. Context around this subclause clearly states
that system() is indeed a function, not a macro.
Jul 23 '05 #8

"codigo" <co****@codigo.trap.com> wrote in message
news:FW*******************@news20.bellglobal.com.. .
|
| "Ken Human" <ke******@comcast.net> wrote in message
| news:fN********************@comcast.com...
| > Victor Bazarov wrote:
| > > sa***********@gmail.com wrote:
| > >
| > >>I want to run a program from the program im writing. For example when
| > >>my program is running I want it to open up an internet explorer
| > >>window. I have been searching and found that there is a RUN command,
| > >>it won't run with any library that I know. so what i am asking for
| > >>is a way to call other programs, or the header file nescarrary to use
| > >>the RUN command.
| > >
| > >
| > > Post this to 'comp.os.ms-windows.programmer.win32'. They will help you
| > > with available means of starting another process in Windows.
| > >
| > > V
| > >
| > >
| >
| > The system(const char *) function is available in cstdlib. Look at the
| > following code:
|
| Its not a function, its a macro and its not c++ either. So you are off
| topic.

[snip]

Where did you get that idea from?

Cheers,
Chris Val


Jul 23 '05 #9
codigo wrote:
The system(const char *) function is available in cstdlib. Look at the
following code:
Its not a function, its a macro


Says who?
and its not c++ either.
Depends on your definition of "c++". Here, people usually define it as "the
language defined by ISO/IEC 14882", and in that language, the headers
<stdlib.h> and <cstdlib> do declare such a function.
So you are off topic.
Nope.
Redirecting the OP to the appropriate newsgroup is beneficial for both the
users here and the OP. For example, in this specific case, cstdlib's
system macro isn't the recommended way to launch that application
It is the best way the standard offers.
and the executable in question is not found in the windows environment
path.


Well, other functions that might guarantee something like that are off-topic
here ;-)

Jul 23 '05 #10

"Rolf Magnus" <ra******@t-online.de> wrote in message
news:d4*************@news.t-online.com...
codigo wrote:
The system(const char *) function is available in cstdlib. Look at the
following code:
Its not a function, its a macro


Says who?
and its not c++ either.


Depends on your definition of "c++". Here, people usually define it as

"the language defined by ISO/IEC 14882", and in that language, the headers
<stdlib.h> and <cstdlib> do declare such a function.
So you are off topic.
Nope.
Redirecting the OP to the appropriate newsgroup is beneficial for both the users here and the OP. For example, in this specific case, cstdlib's
system macro isn't the recommended way to launch that application


It is the best way the standard offers.
and the executable in question is not found in the windows environment
path.


Well, other functions that might guarantee something like that are

off-topic here ;-)


lol. point taken. Thanks for the input, guys.
Jul 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chua Wen Ching | last post: by
13 posts views Thread by PinkBishop | last post: by
3 posts views Thread by Eric_Dexter | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.