3

BINMEMO
A Program For Moving Binary Files In and Out of FoxPro Memo Fields
by Greg Dunn
MEMO itself, I have need for a small
FoxPro, unlike other dialects ofxBase, database file for use in building a list of allows binary data to be stored in memo memo fields. (I use a database file rather fields. That means that you can, among than an array because I have no way of other things, stuff DOS files of any knowing, in advance, how many items will into memo fields. Even better than that, end up in my list.) Now I almost always you can get them back out again! Your associate a SYS.DBF with my applica.DBF file becomes an infinitely expan- tions, and in file SYS keep various utility sible briefcase, information, such as next index key
I’ve thought of a number of uses for values, user configuration data, and the
this facility, and I’ll bet you can think of like. I decided this SYS file would be a
more. For example: in program BIN- nice place to keep my utility .DBF, which


BINMEMO is also useful in extracting help entries from the Fox (or Tom Rettig’s) help file. You can write the entries to disk, then print them using your favorite printer utility. Or modify BINMEMO to print memos directly!
Procedure binmemo


SET PROCEDURE TO binmemo
PRIVATE ALL
CLOSE ALL
CLEAR ALL
CLEAR
SET TALK OFF
SET BELL OFF
SET SAFETY OFF
SET CONFIRM ON
SET sysmenu ON
SET MESSAGE TO 22 center

DEFINE WiNDOW w_brow FROM 5,5 TO 20,74 CLOSE FLOAT GROW’
ZOOM IN SCREEN TITLE ‘Choose a record’ SYSTEM SHADOW;
COLOR SCHEME 10

SELECT 0 && activate unused work area
USE sys && open the ‘system’ file (contains various stuff && used by this program)

* The utility dbf file MEMOUST.DBF, used later in this
* program, is kept in a memo field in SYS.DBF. We now
* extract it to the disk so it will be available when
* we need it. It will be deleted from the disk at the
* termination of this program.

IF FlLECmemolist.dbf”)
DELETE FILE memolist.dbf
ENDIF

memfield = mLdbr fname = ‘memolist.dbf w_handle = 0 DO createfile WITH fname, w_handle IF lw_handle = = -1 DO writefile WITH w_handle, (memfield)
ELSE
= terminateO
ENDIF

continues on page 6
LA. FOX

3