Jump to content
  • Advertisement
Sign in to follow this  
ErUs

starting another program...

This topic is 4838 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

string temp += (char) 34; // "
temp += buff; temp += (char) 92; temp+= "daisy.exe";	
temp += (char) 34;

system( temp.c_str() );



doesnt work :( i am trying to start another app from within mine and i am using the win32 platform. please help i logged the string from the code above so i know its valid

Share this post


Link to post
Share on other sites
Advertisement
oh god :(

y do they make it such hard work ?

10 params - and some of which are struct ;(

isnt there a function called popen or something?

Share this post


Link to post
Share on other sites
I'm pretty sure you shouldn't include the "s in the string you send to system.
And, about CreateProcess, check the examples. You can substitute most of the arguments for NULL.

Share this post


Link to post
Share on other sites
aha!

sorry guys it is infact a problem with the other app.

unless its started by me double clicking it it gives an error - for example i cant open console drag the app in and press enter :(

Share this post


Link to post
Share on other sites
There is a function called popen...but it's for piping the output from a console command. Also not standard Win32 API (and therefore not guaranteed to correctly run your program).

Try replacing your system( ) call with:

CreateProcess(temp.c_str(), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, NULL);


EDIT:
This problem with the other app means either a) it can't be run from the console (which is certainly possible; using CreateProcess will still run it however), or b) it's not an app at all (it may be a shortcut, or a file designed to be opened by other apps; in that case look into ShellExecute).

Share this post


Link to post
Share on other sites
it is definatly an executable

*trying shellexecute*

http://leedberg.com/glsoft/daisy/index.shtml there is the app

Share this post


Link to post
Share on other sites
system does indeed work to start another app
but it has its limits
it returns when the other program terminates
and you don't get the fancy win32 options that you get with create processes

Share this post


Link to post
Share on other sites
Quote:
Original post by ErUs
unless its started by me double clicking it it gives an error - for example i cant open console drag the app in and press enter :(


What error do you get?

I suspect it is a problem of "working directory". Is your program using files with a relative path? If so, it will look for them relative to where the program was started from, not where the executable resides.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!