Software testing program

Started by
6 comments, last by bytecoder 19 years, 6 months ago
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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Advertisement
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]

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
No, entering the main into a loop doesnt work. I will have to do it the hard way.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
You *could* do it with a batch file, but I'm not sure if it's what you want.

@ECHO OFF:RUNpause>>>execute program here<<IF ERRORLEVEL 0 GOTO RUN

(remove the "pause" to have it continue without asking)
Ra
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?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
like so:

" "

xD

Thermo
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