I Need help with a command

S

salerno.david

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.
 
V

Victor Bazarov

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
 
K

Ken Human

Victor said:
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!
 
C

codigo

Ken Human said:
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!
 
K

Ken Human

codigo said:
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


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().
 
K

Krishanu Debnath

Ken said:
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
 
I

Ioannis Vranos

codigo said:
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?
 
K

Ken Human

Krishanu said:
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.
 
C

Chris \( Val \)

|
| | > Victor Bazarov wrote:
| > > (e-mail address removed) 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
 
R

Rolf Magnus

codigo said:
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
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 ;-)
 
C

codigo

Rolf Magnus said:
Says who?


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


It is the best way the standard offers.


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

lol. point taken. Thanks for the input, guys.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,293
Messages
2,571,500
Members
48,187
Latest member
ashish_758

Latest Threads

Top