Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SET DEVICE, Set(“Device”), Sys(101)

This group is more old Xbase baggage. SET DEVICE lets you redirect the output of @ .. SAYs while the two functions tell where that output is going at the moment.

Usage

SET DEVICE TO SCREEN | PRINTER [ PROMPT ] | FILE FileName
cCurDevice = SET( "DEVICE" [, 1 ] )
cCurDevice = SYS( 101 )

Once upon a time, the @ .. SAY command was one way to produce reports. By twiddling the DEVICE setting, you could have the report appear either on screen, on paper or in a file. With SET(“DEVICE”) or SYS(101), you could even remember how it was set beforehand and restore it. If you designate a file destination, SET(“DEVICE”) returns “FILE” and SET(“DEVICE”,1) returns the destination filename.

In Visual FoxPro, @ .. SAY is a terrible way to produce reports, so there’s not much reason to touch the DEVICE setting.

Incidentally, if you SET DEVICE TO PRINT, the actual output location is controlled by the setting of SET PRINT TO.

Example

SET DEVICE TO PRINT
* Issue @ .. SAYs to send a report to the printer
SET DEVICE TO SCREEN

See Also

@…Say, Set, Set Print