Jump to content
  • Advertisement
Sign in to follow this  
The C modest god

Software testing program

This topic is 5412 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

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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
You *could* do it with a batch file, but I'm not sure if it's what you want.

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




(remove the "pause" to have it continue without asking)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!