Running MS-DOS within a c++ program (Code) | | |
What i want to do is have my c++ program, run a DOS program and copy a
script from that DOS program to a file. I simply have no idea, how, or
if it's plausable, to run DOS within a c++ program. It's a command
prompt, within a command prompt. Any input would be great.
Thanks
Brune | | | | re: Running MS-DOS within a c++ program (Code)
* Mike:[color=blue]
> What i want to do is have my c++ program, run a DOS program and copy a
> script from that DOS program to a file.
>
> I simply have no idea, how, or
> if it's plausable, to run DOS within a c++ program. It's a command
> prompt, within a command prompt. Any input would be great.[/color]
Off topic.
Try over in [comp.os.ms-windows.programmer.win32].
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? | | | | re: Running MS-DOS within a c++ program (Code)
Alf P. Steinbach wrote:[color=blue]
> * Mike:[color=green]
> > What i want to do is have my c++ program, run a DOS program and copy a
> > script from that DOS program to a file.
> >
> > I simply have no idea, how, or
> > if it's plausable, to run DOS within a c++ program. It's a command
> > prompt, within a command prompt. Any input would be great.[/color]
>
> Off topic.
>
> Try over in [comp.os.ms-windows.programmer.win32].
>[/color]
Can he not try the system() function? | | | | re: Running MS-DOS within a c++ program (Code)
Mike wrote:
[color=blue]
> What i want to do is have my c++ program, run a DOS program and copy a
> script from that DOS program to a file. I simply have no idea, how, or
> if it's plausable, to run DOS within a c++ program. It's a command
> prompt, within a command prompt. Any input would be great.[/color]
As far as standard C++ is concerned, the std::system() function from
<cstdlib> seems to be the only way to call another program from within C++.
Maybe, something like
std::system( "my_program.exe > my_file.script" );
works on your platform -- but that is just a wild guess.
If that does not work for you, you may want to resort to the use of
(platform specific) 3rd party libraries, which are, however, off-topic in
this group.
Best
Kai-Uwe Bux | | | | re: Running MS-DOS within a c++ program (Code)
"Shark" <cpp_shark@yahoo.com> wrote in message
news:1138061771.930066.65140@g49g2000cwa.googlegro ups.com...
| Alf P. Steinbach wrote:
| > * Mike:
| > > What i want to do is have my c++ program, run a DOS program and
copy a
| > > script from that DOS program to a file.
| > >
| > > I simply have no idea, how, or
| > > if it's plausable, to run DOS within a c++ program. It's a
command
| > > prompt, within a command prompt. Any input would be great.
| >
| > Off topic.
| >
| > Try over in [comp.os.ms-windows.programmer.win32].
| >
|
| Can he not try the system() function?
|
system() is not part of the standard, hence off topic. The rule is if it
only runs on Windows (or if it only runs on any other OS), then its
probably off topic here. The C++ community expends a great deal of
effort to provide a standard that applies to any OS, including those
that are yet to be invented. | | | | re: Running MS-DOS within a c++ program (Code)
* Peter_Julian:[color=blue]
>
> system() is not part of the standard, hence off topic. The rule is if it
> only runs on Windows (or if it only runs on any other OS), then its
> probably off topic here. The C++ community expends a great deal of
> effort to provide a standard that applies to any OS, including those
> that are yet to be invented.[/color]
You mean, system() is part of the standard, but any particular use of it
is not.
In addition to your comments, I don't think the system() function would
solve the OP's problem. But I could be wrong. The problem was not very
clearly explained.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? | | | | re: Running MS-DOS within a c++ program (Code)
Peter_Julian wrote:
[color=blue]
> "Shark" <cpp_shark@yahoo.com> wrote in message
> news:1138061771.930066.65140@g49g2000cwa.googlegro ups.com...
> | Alf P. Steinbach wrote:
> | > * Mike:
> | > > What i want to do is have my c++ program, run a DOS program and
> copy a
> | > > script from that DOS program to a file.
> | > >
> | > > I simply have no idea, how, or
> | > > if it's plausable, to run DOS within a c++ program. It's a
> command
> | > > prompt, within a command prompt. Any input would be great.
> | >
> | > Off topic.
> | >
> | > Try over in [comp.os.ms-windows.programmer.win32].
> | >
> |
> | Can he not try the system() function?
> |
>
> system() is not part of the standard, hence off topic. The rule is if it
> only runs on Windows (or if it only runs on any other OS), then its
> probably off topic here. The C++ community expends a great deal of
> effort to provide a standard that applies to any OS, including those
> that are yet to be invented.[/color]
system() is entirely standard. Before calling system("send this to the
command processor") you can find out whether a command processor is
available.
I believe that is done by calling system(0) which return non-zero if a
command processor is present, zero otherwise. But I don't have a
definitive C library reference to hand to be absolutely sure.
Of course, how the command processor on a particular platform behaves
in response to any particular command is outside the scope of standard
C++.
Gavin Deane | | | | re: Running MS-DOS within a c++ program (Code)
Thanks for the input, I apologize if this is off topic, I understand
the basic idea of the system function, though it doesn't allow me to
access specific executables within specific directories. Or if it does
i haven't discovered how to do that yet. I beleive that if I could
access my executable then it would work. But i can't seem to access
the proper executable. Any more ideas are great. Thanks for the input
thus far. Again sorry this is off topic
Brune |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,471 network members.
|