Hi, you may want to change this code to fit your needs:
[tt]
cInFile = "testdata.txt"
cOutFile = "testdata.dbf"
cSeparator = ";"
nMaxColWidth = 25
nHandle = fopen(cInFile)
if nHandle < 0
wait window "Can't open file"
cancel
endif
cString = fgets(nHandle)
nFields = occurs(cSeparator, cString)
cFields = ""
for f = 1 to nFields
cFields = cFields + "fld" + ltrim(str(f)) + ;
" C(" + ltrim(str(nMaxColWidth)) + "), "
endfor
cFields = left(cFields, len(cFields) - 2)
create dbf (cOutFile) (&cFields)
= parse()
do while not feof(nHandle)
cString = fgets(nHandle)
= parse()
enddo
= fclose(nHandle)
procedure parse
nFieldNo = 1
do while nFieldNo <= nFields
nPos = at(cSeparator, cString)
cCol = "fld" + ltrim(str(nFieldNo))
&cCol = left(cString, nPos - 1)
cString = substr(cString, nPos + ;
iif(nFieldNo < nFields, 1, 0))
nFieldNo = nFieldNo + 1
enddo
insert into (cOutFile) from memvar[/tt]