PRB: @ ... SAY to Text File Causes Page to EjectLast reviewed: November 28, 1995Article ID: Q121958 |
The information in this article applies to:
SYMPTOMSIssuing 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.
CAUSEFoxPro 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.
RESOLUTIONIssue 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 @ ... SAYIn 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 BehaviorRun 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |