I have 2 files; one called calc.exe and the other plot.exe. The file
calc.exe creates data and sends it to a file while plot.exe reads the
data from the file and plots it.
How can I execute plot.exe while running calc.exe.
Printable View
I have 2 files; one called calc.exe and the other plot.exe. The file
calc.exe creates data and sends it to a file while plot.exe reads the
data from the file and plots it.
How can I execute plot.exe while running calc.exe.
get a look at the "exec" and at the "spawn" functions family.
Alessandro
Why do we hide from the police, Dad?
Because we use vi, Son. They use emacs.
hi,
if u use NT/95/98 use CreateProcess as shown below !
void Runanother ( LPSTR lpszFilename)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si); // Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
lpszFilename, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent’s environment block.
NULL, // Use parent’s starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
Error ("CreateProcess failed.");
return;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
enjoy the code !
I don't understand how to send the filename. The
LPSTR command doesn't make sense. Can you
please, please, please, show me how to call this
function. Let's say I want to call the program
c:\windows\calc.exe
** RunAnother ( LPSTR lpszFilename) **
Call like this -> RunAnother ( "c:\windows\calc.exe" );