Article ID: 115418
Article Last Modified on 3/3/2005
"FRED","FLINTSTONE","A movie about Barney and Betty" "RENO","RAINES","The Renegade"The following program will add this data to the database:
*MYMEMO.PRG
m.numchars=0
m.end=.F.
m.bytestoend=0
IF USED("mymemo")
SELECT mymemo
ELSE
IF FILE("mymemo.dbf")
USE mymemo IN 0
SELECT mymemo
ELSE
CREATE TABLE mymemo (first C(10), LAST C(15), details m(10))
ENDIF
ENDIF
H=FOPEN("mymemo.txt",10)
IF ! H<0
m.totalchars=FSEEK(H,0,2) && how many characters in file?
=FSEEK(H,0,0) && go back to start
DO WHILE (! EOF(H) ) AND (! m.end)
m.first=""
m.last=""
m.details=""
FOR m.numfields = 1 TO 3
DO CASE
CASE m.numfields=1
m.field="m.first"
CASE m.numfields=2
m.field="m.last"
CASE m.numfields=3
m.field="m.details"
ENDCASE
m.numquotes=0
DO WHILE m.numquotes < 2 AND (! m.end)
in_char=FREAD(H,1)
DO CASE
CASE in_char=["]
m.numquotes=m.numquotes+1
CASE m.numquotes=1 AND ;
(ASC(in_char)=32 OR (ASC(UPPER(in_char))>64 ;
AND ASC(UPPER(in_char))<91))
STORE EVALUATE(m.field)+m.in_char TO (m.field)
ENDCASE
m.numchars=m.numchars+1
IF m.numchars = m.totalchars && are we at the end?
m.end=.T. && set our own EOF marker
ENDIF
ENDDO
ENDFOR
APPEND BLANK
GATHER MEMVAR MEMO
ENDDO
=FCLOSE(H)
ENDIF
For information about using low-level file commands to export data to a
delimited ASCII file, please see the following article in the Microsoft
Knowledge Base:
95722 How to Export Memo Fields to an ASCII File
Additional query words: VFoxWin FoxMac FoxDos FoxWin import
Keywords: kbinfo kbcode KB115418