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

Last reviewed: November 28, 1995
Article ID: Q121958
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x

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: kbprg kbprint kbcode kbprb
KBSubcategory: FxprintGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 28, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.