473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Jan 24 '06 #1
7 7943
* 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].

--
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?
Jan 24 '06 #2
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?

Jan 24 '06 #3
Mike wrote:
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.


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
Jan 24 '06 #4

"Shark" <cp*******@yahoo.com> wrote in message
news:11*********************@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.

Jan 24 '06 #5
* Peter_Julian:

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.


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?
Jan 24 '06 #6

Peter_Julian wrote:
"Shark" <cp*******@yahoo.com> wrote in message
news:11*********************@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.


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

Jan 24 '06 #7
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

Jan 25 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eddie Borden | last post by:
I have a MS-SQL server in a V-LAN that has other MS-SQL servers in it and is connected to other V-LAN's that have MS-SQL servers. I am trying to lock down this server in everyway possible. I...
1
by: Ambrose | last post by:
Hi Everyone, Apparently, I was being asked on a question, "Why don't we procure a desktop PC to run MS SQL Server 2000 rather than a buying a server?". From a Management point-of-view, buying a...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
3
by: Bruce Acciavatti | last post by:
I've split a rather large Access2000 database that resides on a network drive, by keeping the back-end on the network drive and placing the front-end on the client's hard drive, linked to it. Both...
2
by: Atley | last post by:
What is the best way to run the following file: \\myAppSvr\MyShare\MyFolder\MyAccessDBApp.mdb from my VB.net 2003 App? I tried Shell, but I keep getting a 'File Not Found Error' even though...
3
by: D Stocks | last post by:
Is it possible to have web page hosted by Linux/Apache retrieve data from (and insert data to) an MS Access database that resides on an (Internet-accessible) MS-based machine? Must the MS machine...
1
by: maxvalery | last post by:
Hi, Looking for a quick and dirty on running an Access database as a linked server in SQL Server. Basically, the majority of my stuff is in SQL Server, but there is one lingering...
3
by: olafbrungot | last post by:
I get the following error message when trying to connect to a host database (OBCD connection) with "MS Query". SQL0471N Invocation of routine "SYSIBM .SQLTABLES " failed due to reason...
4
by: plightstone | last post by:
I am designing an MS Access database for a small operation that uses Macs exclusively. Eventually I will be publishing to the internet so it won't matter but I want an interim solution so they can...
1
by: sjohnson1984 | last post by:
Hello, My question is pretty much summed up in the title of this: How do we run queries using SQL Server Agent. Part of my company uses an Access dB, in this Access dB I have an append query...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.