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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN a DOS .exe from VFP 6 - How

Status
Not open for further replies.

Chris1000

Programmer
Jun 4, 2001
2
US
I have found a very useful dos program - xyz.exe - which returns a value in an MSDOS window when it is run.

I want to call this program repeatedly from a VFP program and capture the returned value as a memory variable.

I'm developing this in Win98-2nd, but it should work in other windows 32 versions.

I can find no helpful documentation. Can someone point me in the right direction.

Thanks in advance.

Chris
 
Without a sample for me to test, the best I can do is offer ideas. I don't know if you already tried !dos.exe or run dos.exe; however, with these commands it's difficult to capture the output. Have you tried putting the dos.exe into a batch file and call the dos.exe from the batch file? Within dos it'll be easier to save the output (usually dos.exe > filename.txt). The batch file can then be called within FoxPro via !batchname.bat. The filename.txt can be parsed and read from FoxPro using the fileopen and fgets commands.
 
You might try having the DOS app write write the variable to a text file, then read the text file in VFP. Kludgy, but it should work.
 
This should work:

run "dos.exe > data.txt"
cData = filetostr("data.txt")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top