Click here to Skip to main content
15,922,166 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can a c++ code be executed/run or fired from or within a c++ code?
Posted
Updated 13-Nov-14 5:36am
v4
Comments
Kornfeld Eliyahu Peter 13-Nov-14 10:38am    
Do you mean non-compiled code?
Gbenbam 13-Nov-14 10:42am    
i mean compiled code.
PIEBALDconsult 13-Nov-14 10:48am    
Then what language it was written in doesn't matter.
Gbenbam 13-Nov-14 10:52am    
so how can one go about executing a compiled code from within a php script?
Richard MacCutchan 13-Nov-14 11:02am    
Your question said from within C++ code. Where does PHP come into it?

You could use one of the "Program execution Functions"[^].
 
Share this answer
 
Yes, but exactly how depends on your OS and framework.
If you are using the .NET framework, then the Process class will do it nicely: MSDN[^]
 
Share this answer
 
Comments
Gbenbam 13-Nov-14 10:47am    
I am not using dot net.I am using win32 API.( I might wish to use mfc too)
OriginalGriff 13-Nov-14 10:57am    
It helps if you tell us these things! :laugh:
Try System:
http://www.cplusplus.com/reference/cstdlib/system/
Or better ShellExecuteEx:
http://msdn.microsoft.com/en-gb/library/windows/desktop/bb762154(v=vs.85).aspx
Gbenbam 13-Nov-14 11:10am    
I apologise for the inconvenience. i have corrected the title.
OriginalGriff 13-Nov-14 11:19am    
Not a problem!
But try to remember in future: the more (and more accurate) the information you give us, the more accurately we can answer, and the faster you get a response you can use :laugh:
Gbenbam 13-Nov-14 11:32am    
so is this your last solution still valid considering the change in title?

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