string temp += (char) 34; // "
temp += buff; temp += (char) 92; temp+= "daisy.exe";
temp += (char) 34;
system( temp.c_str() );
starting another program...
I have no idea whether or not the system command should work at all for that, but it's not the standard way of doing that. Check out CreateProcess.
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?
y do they make it such hard work ?
10 params - and some of which are struct ;(
isnt there a function called popen or something?
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.
And, about CreateProcess, check the examples. You can substitute most of the arguments for NULL.
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 :(
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 :(
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:
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).
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).
it is definatly an executable
*trying shellexecute*
http://leedberg.com/glsoft/daisy/index.shtml there is the app
*trying shellexecute*
http://leedberg.com/glsoft/daisy/index.shtml there is the app
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement