Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Write in a *.txt file
Message
From
27/02/2006 11:24:30
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
27/02/2006 04:56:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows XP
Database:
MySQL
Miscellaneous
Thread ID:
01099370
Message ID:
01099499
Views:
24
>HI all,
>
>How Can I write in a *.txt file

Interestingly, I never tried to put together a list of all the ways you can do that in Fox... so let's try to do this now:

1) use low-level file functions (fOpen(), fCreate(), fWrite() etc)... though, with these you can write binaries as well, if you really want.

2) Set Alternate. This will also put an EOF character (i.e. chr(26)) at the end when you close it, and some software that may use the resulting file may not recognize it. Also, you may continue adding more text after that character, but then some other software may acknowledge the EOF marker and refuse to read anything beyond it.

3) Set Text to (file), then use \ and \\ to output text to it

4) text to (file) [additive] ... Endtext

5) compose any text into a string and StrToFile() it

6) have the text in a memo field and Copy Memo ... To (cFile)

7) Type (cTextfile) to file (cTextFile2)... basically copies the file, but with some formatting (see Set Heading)

8) copy/export table or cursor to a file, type SDF or Delimited

9) report form ... to (cfile) type ASCII. Hard to control, format nearly unpredictable

10) set printer to (cFile), set print on, issue a series of ?, ?? statements

11) set printer to (cFile), set device to printer, issue a series of @ ...say statements.

12) use automation and create a document in Word (or other automatable application), save as text.

As you see, your choices are somewhat limited :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform