473,387 Members | 1,481 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,387 software developers and data experts.

how to execute exe files from within a file

Hello!

How can I execute other exe files from within a executable file in GCC.
In TurboC 3, the spawn command executes a file and returns command to
the calling file.

whereas in GCC, the exec command only starts the execution of the new
file and does not return command to the calling file (the calling file
is terminated on the start of execution of the called file)

Is there any command in GCC that after executing the called file,
returns command to the calling file. The called file should be able to
be run in both concurrently as well as putting the calling file on
hold.

Thank You

Casanova

Nov 14 '05 #1
9 3008
On Thu, 16 Dec 2004 08:17:23 -0800, Casanova wrote:
Hello!

How can I execute other exe files from within a executable file in GCC.
In TurboC 3, the spawn command executes a file and returns command to
the calling file.


The standard C function to run external commands is called system() and is
declared in <stdlib.h>. If that won't do what you want (it probably will)
then a good newsgroup to discuss gcc is gnu.gcc.help, but note that gcc is
just a compiler, your question is really about what libraries you happen
to be using with it.

Lawrence
Nov 14 '05 #2
system()
--
Nick Keighley

Nov 14 '05 #3
In article <11**********************@z14g2000cwz.googlegroups .com>
Casanova <pr********@gmail.com> wrote:
How can I execute other exe files from within a executable file in GCC.


See the comp.lang.c FAQ, question 19.27.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Nov 14 '05 #4
On 16 Dec 2004 08:17:23 -0800, Casanova
<pr********@gmail.com> wrote:
How can I execute other exe files from within a executable file in GCC.
In TurboC 3, the spawn command executes a file and returns command to
the calling file.
The only method specified in standard C is system().
whereas in GCC, the exec command only starts the execution of the new
file and does not return command to the calling file (the calling file
is terminated on the start of execution of the called file)

Is there any command in GCC that after executing the called file,
returns command to the calling file. The called file should be able to
be run in both concurrently as well as putting the calling file on
hold.


No (it would be in the system library rather than in GCC itself, so
check about your system libraries). The conventional way to do it on
Unix is to fork(2) a process which then calls exec(3) to run the
program, while the original process wait(2)s for it to complete. Or you
can use popen(3) which allows you to write to the program's standard
input or read its standard output. But these are outside the standard C
specification (although they are in the POSIX specification so are
standard on systems which are conformant to that, like most Unix
systems).

[Note: numbers in parentheses like fork(2) refer to the man(1) section
numbers...]

Chris C
Nov 14 '05 #5

in system() i wont be able to pass parameters. I have to open a exe
file which has to take command line parameters.

And just in case this is relevant. I am programming for the windows
platform

Nov 14 '05 #6
Casanova <pr********@gmail.com> wrote:
in system() i wont be able to pass parameters. I have to open a exe
file which has to take command line parameters.
Well, you pass the whole command line, including the parameters, to
system().
And just in case this is relevant. I am programming for the windows
platform


If this is relevant then you're off-topic here and you should better
ask in a MS programming group.
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #7
Casanova wrote:

in system() i wont be able to pass parameters. I have to open a exe
file which has to take command line parameters.

And just in case this is relevant. I am programming for the windows
platform


Of course you can pass parameters - you can pass anything you like
in a text string. What is done with them is not dependant on the C
language, but on the shell which which you are actually
communicating. That is system dependant, and OT here.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #8
In article <sl******************@ccserver.keris.net>,
Chris Croughton <ch***@keristor.net> wrote:
....
The conventional way to do it on Unix is to fork(2) a process which then
calls exec(3) to run the program, while the original process wait(2)s for
it to complete. Or you can use popen(3) which allows you to write to the
program's standard input or read its standard output. But these are
outside the standard C specification (although they are in the POSIX
specification so are standard on systems which are conformant to that,
like most Unix systems).
All of which is clearly irrelevant to (and most likely to utterly confuse)
the OP, since s/he is clearly a Windoze dork.
[Note: numbers in parentheses like fork(2) refer to the man(1) section
numbers...]


This, too.

Nov 14 '05 #9
On Fri, 17 Dec 2004 17:34:15 GMT, Kenny McCormack
<ga*****@yin.interaccess.com> wrote:
In article <sl******************@ccserver.keris.net>,
Chris Croughton <ch***@keristor.net> wrote:
...
The conventional way to do it on Unix is to fork(2) a process which then
calls exec(3) to run the program, while the original process wait(2)s for
it to complete. Or you can use popen(3) which allows you to write to the
program's standard input or read its standard output. But these are
outside the standard C specification (although they are in the POSIX
specification so are standard on systems which are conformant to that,
like most Unix systems).


All of which is clearly irrelevant to (and most likely to utterly confuse)
the OP, since s/he is clearly a Windoze dork.


If they are using GCC, as stated in the OP's question, they are likely
to have the rest of the libraries as well and be running with a
"Unix-like" environment such as Cygwin (under Windows) or DJGPP (under
MSDOS, likely since "Turbo C" was mentioned).
[Note: numbers in parentheses like fork(2) refer to the man(1) section
numbers...]


This, too.


Again, both Cygwin and DJGPP provide man.

Chris C
Nov 14 '05 #10

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

Similar topics

7
by: MAK | last post by:
Hello everyone, I know how to add images and icons etc to dll file. What I would like to know is there is a way to add those icons on the forms during the run time from the dll or to reference it ...
0
by: Wilk Teverbaugh | last post by:
I've got an include file inside each page throughout my site. Inside this include file I'm running server.execute to include other pages based on a condition (userID). The problem has two parts-...
0
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users...
1
by: Randy Developer | last post by:
Ok, I've searched the web and newsgroups for a week now with no concrete answer. Question: How, if possible, can you either navigate to or get a listing of a directory to load on an asp page and...
9
by: tshad | last post by:
I have an example I copied from "programming asp.net" (o'reilly) and can't seem to get the Sub (writefile) to execute. It displays all the response.write lines that are called directly, but not...
1
by: Eric Wood | last post by:
We have an application that is accessed using shared drives, client executes program from server. We have already coded the program to create and save the a bat file either locally on the users...
9
by: sdb1031 | last post by:
I am trying to run an exe within a python script, but I'm having trouble with spaces in the directory name. The following example will display the usage statement of the program, so I know that...
6
by: Sam | last post by:
My problem is that when I am trying to use Server.Execute("Somehandler.ashx") I am getting HttpException. System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer,...
2
by: techgirl | last post by:
Hi All- I was wondering if anyone could help me with this issue. I am trying to run this 3rd party application called "CoreFTP.exe" from within C#. I have tested my code with "Notepad.exe" and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.