ASIN()

Append Memo, Copy Memo

These commands let you move data between files and memo fields. Though Help implies that only text files can be manipulated this way, in fact these commands are also good for moving binary files in and out of memo files. You might, for example, store a compiled program in a memo field, then copy it to a file and run it when you need it. Memos can also store bitmaps, to be displayed when needed, if the resource overhead of OLE is too much for your targeted audience.

Usage

APPEND MEMO MemoField FROM FileName         [ OVERWRITE ]         [ AS nCodePage ] COPY MEMO MemoField TO FileName         [ ADDITIVE ]         [ AS nCodePage ]

Parameter

Value

Meaning

MemoField

Name

The memo field into or out of which data is to be copied.

FileName

Name

The file from or into which the data is copied.

nCodePage

Numeric

The code page of the file.


At first glance, it seems odd that APPEND MEMO has OVERWRITE as an optional keyword while COPY MEMO has the inverse ADDITIVE. But all the APPEND commands add to existing data rather than replacing it, by default. On the other hand, COPY commands in FoxPro all default to replacing existing data. So, while these two are mutually inconsistent, they're each consistent with other commands. Guess we can't complain about that too much, except to wonder who made the initial decision way back when that APPEND and COPY should behave differently.

The optional AS clause lets you deal with the case that the text file uses a different code page than the table. You can specify the file's current code page and the data is translated on the way in. If you don't specify, the data is copied as-is (which is what you probably want in the case of, say, object code). In that case, you'll probably also want to mark the memo field as NOCPTRANS.

Example

* Store a compiled program in a memo field APPEND MEMO mProgram FROM MyProgram.FXP OVERWRITE * Now you can save it out and run it later cProgramFile = SYS(3) + ".FXP" COPY MEMO mProgram TO (cProgramFile) DO (cProgramFile)

See Also

Alter Table, Append From, Copy File, Copy To, Create Table, Set NoCPTrans


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net