How to Use SET ALTERNATE TO Instead of Low-Level I/OLast reviewed: November 21, 1995Article ID: Q122863 |
The information in this article applies to:
SUMMARYYou can use the SET ALTERNATE TO command to create ASCII text files instead of using FoxPro's low-level file input/output (i/o) commands.
MORE INFORMATIONThere is no code example in the Help file or the "FoxPro Language Reference" that shows you how to use the SET ALTERNATE TO command. This article gives a basic code example that demonstrates how to use the SET ALTERNATE TO command to create an ASCII text file.
* BEGINNING OF CODE USE customer && Open the customer database. This && database can be found in the Tutorial && subdirectory in the FoxPro directory. SET CONSOLE OFF && Do not echo information to the screen && when using question marks. SET ALTERNATE TO temp && Output will be sent to file TEMP.TXT. SET ALTERNATE ON && From this point on, using ? will write && information to the file TEMP.TXT. * Write the following information to the file. ?'THIS IS TEST ONE.' ?cno x="THIS IS TEST TWO." ?x SET ALTERNATE OFF && Question marks output will now output && to the screen instead of the file, && which is the default. SET ALTERNATE TO && Closes the file. SET CONSOLE ON && Turn console on to resume normal screen output && echoed to the screen. USE && Close the customer database. MODIFY FILE TEMP.TXT && Open the output file TEMP.TXT, so it can && viewed. * END OF CODEAt this point, the text file contains three lines: THIS IS TEST ONE. <some CNO number from the customer database> THIS IS TEST TWO.
|
Additional reference words: FoxWin FoxDos FoxMac 2.50 2.50a 2.50b 2.50c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |