473,467 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Run an .exe file from an c++ application

13 New Member
Hi all,

How to run one c++ .exe file from another c++ application...
I used following code...but not working..

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<stdlib.h>
  3. int main() 
  4. {
  5. system("C:\Rupali1\c++ examples\listConcat\Debug\listConcat.exe");
  6. //system("explorer.exe");
  7. return i;
  8. }
  9.  
Jun 22 '07 #1
4 2520
sicarie
4,677 Recognized Expert Moderator Specialist
Hi all,

How to run one c++ .exe file from another c++ application...
I used following code...but not working..

Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<stdlib.h>
  3. int main() 
  4. {
  5. system("C:\Rupali1\c++ examples\listConcat\Debug\listConcat.exe");
  6. //system("explorer.exe");
  7. return i;
  8. }
  9.  
I would imagine you are getting issues with the "c++ examples" part of your path. Try renaming the directory to have an underscore, and see if that works. You could also try backwhacking\ the\ space\ that\ is\ in\ there\. (If you couldn't tell, that's putting a slash right before the space - tells the compiler to expect the space. I'm not sure how well that works on Windows machines - I know I've done it several times on Linux machines.)


::Edit:: you might also try backwhacking the slashes - that just occurred to me. So, something like: C:\\Documents\ and\ Settings\\Username\\directory\\file_to_execute.exe , or some combination of those things.
Jun 22 '07 #2
niskin
109 New Member
The problem lies in the path of your program:

system("C:\Rupali1\c++ examples\listConcat\Debug\listConcat.exe");

This is incorrect as the backslash is used for other things in C and C++ so what you need to do is put 2 of them:

system("C:\\Rupali1\\c++ examples\\listConcat\\Debug\\listConcat.exe");

Personally, just to be safe I would put:

system("cd C:\\Rupali1\\c++ examples\\listConcat\\Debug & listConcat.exe");

Happy programming.
Jun 22 '07 #3
vpawizard
66 New Member
Hello,
U can also use exec*() functions.
http://linux.about.com/library/cmd/blcmdl3_execl.htm

Regards,
Jun 23 '07 #4
Rupali12345
13 New Member
Hi,

system("cd C:\\Rupali1\\c++ examples\\listConcat\\Debug & listConcat.exe");

This is working fine................

Thanks.
Happy Programming To U also.
Jun 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I...
7
by: Lalasa | last post by:
Hi, Can anybody tell me how many cpu cycles File.copy would take and how many cpu cycles File.Move would take? CFile::Rename in C++ takes just one cpu cycle. As there is no File.Rename in C#,...
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
5
by: Baren | last post by:
Hi! I am using impersonate="true" to upload and download files from a network share. I have created common users on both the webserver and the file server. The user has permission to the...
5
by: Neo | last post by:
Hello, I am receiving a file as a binary stream from a C++ Client Application. >From the application, the file is being sent as a "Multipart/form-data". I want to receive this file on the...
19
by: Noozer | last post by:
I need to keep my application settings in a file that users can copy/backup/etc. Before I start using the old INI file standard, is there any easy way to use XML files to hold application...
11
by: Alan T | last post by:
I added a resource file into my project, to store the caption of buttons and labels.. How do I make use of this resource file to dynamically assign to the buttons and labels ?
1
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
5
by: Eugene Anthony | last post by:
ds1.Tables.Rows.ItemArray.GetValue(0).ToString() contains the string path: images/5/Video1/qbert.flv if (File.Exists(ds1.Tables.Rows.ItemArray.GetValue(0).ToString())) { //code to execute } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
1
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...
0
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...

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.