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

how to run some exe file by using standard C++ code?

I have some program in the executable form (for example notepad.exe in
windows) and I want to run it in C++ code. How to do it?

Sep 19 '07 #1
3 4762
On 2007-09-19 16:19, Pawel_Iks wrote:
I have some program in the executable form (for example notepad.exe in
windows) and I want to run it in C++ code. How to do it?
You cannot. Or to be exact, your really should not, the only way to do
it in standard C++ is to use system(), but using system() is generally a
bad idea. To run another program you need to use code specific to your
platform, on both Windows and POSIX systems (UNIX and LINUX) there is a
family of functions with names starting with exec which can be used. For
more information please consult a group discussing programming on your
system: http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

--
Erik Wikström
Sep 19 '07 #2
On 19 Wrz, 16:32, Erik Wikström <Erik-wikst...@telia.comwrote:
On 2007-09-19 16:19, Pawel_Iks wrote:
I have some program in the executable form (for example notepad.exe in
windows) and I want to run it in C++ code. How to do it?

You cannot. Or to be exact, your really should not
your answer is mysterious ... why I should not do it?

Sep 19 '07 #3
I have some program in the executable form (for example notepad.exe in
windows) and I want to run it in C++ code. How to do it?

You cannot. Or to be exact, your really should not
>your answer is mysterious ... why I should not do it?
Not sure what he means either. Maybe he's saying that
you'd be better using a platform specific way (like
createprocess() on windows or whatever it's called.)

If you just want to launch the exe, then
std::system("notepad.exe");

should do it as long as notepad.exe is in your path
or you specify the path.

The thing is, that once you load whatever you want, you'll
likely want to hook it in some way and that's a different
story.
Sep 19 '07 #4

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

Similar topics

2
by: Paul LAURENT | last post by:
Hi everybody, I am using the STL "ofstream" class. I open a file using "ofstream" in update at the end mode ("ate"), I can read and write my file correctly. => What I would like to do is...
6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being...
10
by: ibic | last post by:
Just curious: is it possible to recursively list all the directorys/files inside a given directory using standard c i/o library routines only, which can be re-compiled and run on any os supportes c...
1
by: nirub | last post by:
hi this nirub i want the guideness for deleting the folder and its files... here i attached my code deleting file but i cant delete the folder.. if any of one give me idea for that..... ...
0
by: egp | last post by:
Hi guys, I have a database using Ms Access 2003 connected to VB6 using ADODB Connection and I want to know how to: - display Ms Access report in VB using VB code then print it out - backup and...
1
by: keyjen2017 | last post by:
i am trying to read the table in DB2 using JAVA code. then it is supposed to be copied in .txt file. how can i do this? other thing, i m passing date in dddd-mm-yy format from JAVA codeto call a ...
6
by: VishalK | last post by:
Friends.. I have a HTML file. Using HTML Code, I want to change its file extension from .html to .mht. eg : TestFile.html to be converted to TestFile.mht Anybody has any idea about this ? Please...
4
by: pninja005 | last post by:
How does one get the correct length of a text file in standard c ? I know ftell() does not work due to the carriage return-linefeed translation. Thanks for any help !
1
by: sankar999 | last post by:
Hi All, Please help me in writing the code for extracting the data values from the XML file using C++ code. The xml file is as follows <?xml version="1.0" encoding="utf-8"?> <Settings...
2
by: pisey | last post by:
function remove() { var myObject; myObject = new ActiveXObject("Scripting.FileSystemObject"); var f = myObject.GetFile("c:\\test.txt"); f.Delete(); }
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
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...
0
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,...
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...
0
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...

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.