Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get exit value 1

Status
Not open for further replies.

kubatk

Programmer
Jul 26, 2005
6
CZ
Hello everybody,
I run an external program from FP 2.5 DOS application using RUN/! command and need to get exit value of that program.
One solution could be running BATCH file instead of EXE directly and test ERRORLEVEL, save it into a file which could then be read in FP application.
But this seems to me rather complicated and "not very nice".
Has somebody more simple and straightforward solution?
Thanks for your help.
 
I agree that a batch file isn't the most elegant of solutions but it works and it's reliable. You don't say which operating system you're using but I suspect you'll find it difficult to delve into the API of something like Windows XP from a 12-year-old program.

Geoff Franklin
 
If the external program is written by you, you could use the following simple method.
Create a text file containing one word "failure" in Foxpro.
Have your external program change that word to "Success" having successfully completed. When control is returned to Foxpro, ask Foxpro to check that the word is "Success" in the text file.
 
Thank you both for the answers.
I wrote that application many years ago, it is (still) run on DOS and Windows 98 workstations and now I am forced to do some changes in it [mad] .
The program that is run from it isn´t my product.
It is strange that there is no sys() function that could be used!
 
I tried solving this problem long time ago and I could not find any fox function. I wrote a little EXE program for catch errorlevel.
My program is on
Call: prunprg.exe YourProgram.exe
Return: created prunprg.txt is filled somthing like this:
DOSERROR = 2
DOSEXITCODEL= 0
DOSEXITCODEH= 0
 
Thanks, this is a better solution than running a batch file and invoking another command.com (dík Tomáši [smile]).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top