DOCUMENT:Q121958  09-NOV-1994  [FOXPRO]
TITLE   :PRB: @ ... SAY to Text File Causes Page to Eject
PRODUCT :Microsoft FoxPro
PROD/VER:2.5x 2.60 2.60a | 2.00 2.5x 2.60 2.60a
OPER/SYS:WINDOWS         | MS-DOS
KEYWORDS:kbprg kbprint kbcode

--------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
 - Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
--------------------------------------------------------------------

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.

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN
RISK. Microsoft provides this code "as is" without warranty of any kind,
either express or implied, including but not limited to the implied
warranties of merchantablility and/or fitness for a particular purpose.

   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 2.00 2.50 2.50a 2.50b 2.60 2.60a
unnecessary extraneous eject character
KBCategory: kbprg kbprint kbcode
KBSubcategory:

=============================================================================

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.

Copyright Microsoft Corporation 1994.