Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C++
fopen("temp.exe",r);


[Update]
i want to run exe within exe without system call

What I have tried:

exe file or executable file can be opened in c program when it is sure that its not the file that is in execution. i mean while a program named temp.exe is running n in that program another say text.exe file starts running
Posted
Updated 26-Mar-16 0:14am
v4
Comments
Jochen Arndt 24-Mar-16 12:20pm    
So what is your question?
Patrice T 26-Mar-16 4:20am    
What do you mean by "open" ?
What do you want to do with it ?
Ravinder Singh 26-Mar-16 5:34am    
i want to run exe within exe without system call
Alan N 26-Mar-16 6:19am    
Just write your own operating system. Try it!
Ravinder Singh 26-Mar-16 7:50am    
i will love to write but since i know for operaating system i must first have basic knowledge of asm (which i dont have) so i have to proceed with the tools i have

I assume you mean "run" and not "open". If so, use CreateProcess[^].

/ravi
 
Share this answer
 
Comments
Ravinder Singh 26-Mar-16 2:34am    
is there any other way. i mean without making any system call n without use of api
Ravi Bhavnani 26-Mar-16 10:51am    
I assume you meant "without use of a Windows API". If so, you can use the system() function, but note it's not as efficient as using CreateProcess (on Windows). See https://msdn.microsoft.com/en-us/library/277bwbdz.aspx.
Ravinder Singh 27-Mar-16 3:54am    
system() is a function of Dos.h header file and dos.h primarily check win32 API
and CreateProcess also does the same
Ravi Bhavnani 27-Mar-16 10:14am    
Yes, I know. I was offering a syntactically simpler approach to starting an .exe from your app.
Quote:
Please tell how to open a .exe file through fopen
fopen is used to read or write in a file, not to launch an executable.
Quote:
i want to run exe within exe without system call
There is no other way.
In fact there is another way: you just have to duplicate that system call.


[Update]
Quote:
there surely are some ways possible to do so because if there is no such way then our operating system will also not work its basic lie in this concept

The OS establish rules to prevent conflicts between programs running at same time. What you want to do simply break all those rules.
You can do it, but you have to find how.
 
Share this answer
 
v6
Comments
Ravinder Singh 26-Mar-16 7:48am    
there surely are some ways possible to do so because if there is no such way then our operating system will also not work its basic lie in this concept
Ravinder Singh 27-Mar-16 3:52am    
i am not conflicting rules of os. our os run with concept of priority n switching btw task in seconds but the main os code run throughout without intruption even when we open any exe also. i mean to say that os codes always run parallel to other applications so how is that possible

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900