473,569 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3024
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************ **********@z14g 2000cwz.googleg roups.com>
Casanova <pr********@gma il.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********@gma il.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********@gma il.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***********@p hysik.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********@yah oo.com) (cb********@wor ldnet.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
specificatio n 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.in teraccess.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
specificati on 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
5629
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 to the dll during the design time, then when I compile the project and install it, then all the images still inside the dll file. not to be...
0
1987
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- 1) The CPU usage jumps up to 100% 2) The path for these include files is different according to the file that is calling server.execute,...
0
2033
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 machine or on the server. Our problem is that when we execute the bat file from the vb code it does not work properly. The bat file is used to connect...
1
2311
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 then doubleclick or hyperlink the files to execute locally. I have already tried the file:///C:\.... approach, but that opens the whole pc to the...
9
2372
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 any of the response.write lines from inside the sub. ******************************************* <%@ Application Language="VB" %> <script...
1
14624
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 machine or on the server. Our problem is that when we execute the bat file from the vb code it does not work properly. The bat file is used to connect...
9
19064
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 the space in the path to the exe is being handled correctly and that the program was executed. CMD= r'"C:\program files\some...
6
4725
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, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)...
2
3015
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 that opens up fine. I've tried it with another program executable and it works as well. When I go to run coreftp.exe, it will not work. I have even...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.