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

Is it possible to record anything printed on the FoxPro screen

Status
Not open for further replies.

Chad101

Programmer
May 13, 2011
2
US
For instance, lets say I ran a prg that had the following output:

?"Running program helloworld.prg"
.
.
.
??"...done!!"

Is it possible to save this output into a cursor or an array?

i.e.

laOutput[1] = "Running program helloworld.prg"
laOutput[2] = "...done!!"

Just curious...
 
Yes, this is quite easy:

Code:
SET ALTERNATE TO somefile.txt
SET ALTERNATE ON
?"Running program helloworld.prg"
.
.
.
??"...done!!"
SET ALTERNATE OFF
SET ALTERNATE TO
[code]

That will get the output to text file. You can then use APPEND FROM to copy it to a cursor; or FILETOSTR() to get it onto a variable.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

[url=www.ml-consult.co.uk]Visual FoxPro articles, tips, training, consultancy[/url]
 
In fact, if your aim is to monitor a running program (to view messages that inidcate what the program is doing), you might be better using DEBUGOUT. That will send the output to a separate window, from where it can be directly saved into a file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The only caveat about DEBUGOUT is that it requires the IDE and won't be available in a runtime application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top