PRB: @ ... SAY to Text File Causes Page to Eject

ID: Q121958

2.5x 2.6x 3.00 | 2.00 2.5x 2.6x

WINDOWS        | MS-DOS
 kbprint  kbprb

The information in this article applies to:

SYMPTOMS

Issuing an @ ... SAY statement whose coordinates are before the coordinates of a previously issued @ ... SAY statement causes a page to eject when output is directed to a text file.

CAUSE

FoxPro cannot issue an @ ... SAY statement to a previous location in a text file. A file does not act like the screen, which can accept input for any location. In a text file, the data must be presented sequentially. It is not possible to move backward in a text file while sending output to it.

RESOLUTION

Issue the @ ... SAY statements sequentially according to their coordinates. For example, @ 1,1 SAY 'Name' would come before @ 2,2 SAY 'Phone'.

To send output to a text file multiple times, (overwriting the file each time) without issuing any page ejects to the file, include code to capture or reroute the page eject. To redirect the page eject, use additional SET DEVICE TO FILE and @ ... SAY statements. The following code sample demonstrates how to do this.

   SET DEVICE TO FILE myfile.txt
   @ 1,1 SAY "Hello"
   @ 2,2 SAY "Good-bye"
   SET DEVICE TO FILE junkfile.txt
   @ 0,0 SAY "" && Page eject will precede this @ ... SAY

In this example, when @ 0,0 SAY "" is executed, FoxPro checks the previous @ ... SAY command. Because the value of the previous @ ... SAY is "2,2", a page eject is sent to JUNKFILE.TXT before @ 0,0 SAY "" is run. If this code is run a second time, no page eject will be sent to MYFILE.TXT because the page eject has already been issued, and the coordinates 1,1 come after 0,0.

MORE INFORMATION

Steps to Reproduce Behavior

Run the following code twice (overwriting MYFILE.TXT during the second run). The second time it is run, a page eject will be issued to MYFILE.TXT.

   SET DEVICE TO FILE myfile.txt
   @ 1,1 SAY "Hello"
   @ 2,2 SAY "Good-bye"

Additional reference words: FoxDos FoxWin VFoxWin 2.00 2.50 2.50a 2.50b 2.60 2.60a 3.00 unnecessary extraneous eject character print KBCategory: kbprint kbprb KBSubcategory: FxprintGeneral
Keywords          : kbcode FxprintGeneral 
Version           : 2.5x 2.6x 3.00 | 2.00 2.5x 2.6x
Platform          : MS-DOS WINDOWS

Last Reviewed: May 22, 1998