Software testing program
I need to write a program that will execute another program and if it returns without error code it runs it again in a loop.
How in my program code do I execute another program in a way that it will not continute until the other program is finished?
First, create the process using CreateProcess, then call OpenProcess to get a handle to the created process, finally, call a wait function, like WaitForSingleObject.
[edit]
Actually, you can use the PROCESS_INFORMATION structure that is passed to CreateProcess to get a handle, then you just have to call a wait function.
[/edit]
[edit]
Actually, you can use the PROCESS_INFORMATION structure that is passed to CreateProcess to get a handle, then you just have to call a wait function.
[/edit]
I figured out I can just enter my whole main scope into a loop.
Will it have the same effect as running the program from another program?
Will it have the same effect as running the program from another program?
You *could* do it with a batch file, but I'm not sure if it's what you want.
(remove the "pause" to have it continue without asking)
@ECHO OFF:RUNpause>>>execute program here<<IF ERRORLEVEL 0 GOTO RUN
(remove the "pause" to have it continue without asking)
I didnt understand this:
If you are using a long filename that contains a space, use quoted strings to indicate where the filename ends and the arguments begin, otherwise, the filename is ambiguous. For example, consider the string "c:\program files\sub dir\program name".
How do I quote the spaces?
If you are using a long filename that contains a space, use quoted strings to indicate where the filename ends and the arguments begin, otherwise, the filename is ambiguous. For example, consider the string "c:\program files\sub dir\program name".
How do I quote the spaces?
You never specified which OS or programming language. It wouldn't be too hard to do in a bash script, although you're most likely using Windows. If you're looking for a way to do it using C standard library functions look up the exec* set of functions and fork.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement