Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to FGET or FPUT more thank 254 chars?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00271674
Message ID:
00271901
Vues:
20
>>Try FGets(InputFile, nBytes), where nBytes is the maximum length of a line.
>
>Maximum of 8192 bytes, at least for VFP6 SP3, that is.
>
>>
>>HTH
>Reading a "lowlevel" file from a unix server. It needs to be opened and looped through the EORs until it gets to the useable data:
>>>When i ..
>>>mybuff=fgets(InputFile)
>>>fputs(OutPutFIle,myBuffs)
>>>
>>>EORs are being inserted at the 254 character position. Eventually the data will be appended delimited to a DBF.
>>>
>>>Thought about STRTOFILE and FILETOSTR, but have not figured as to how (with the need to clear all the chaff before I get to the money data)!


I solved this by appending the text to a memo field created on a temp table (lcTxtWork). I then parsed the table with the following code:

SELECT lcTxtWork
APPEND MEMO mtext FROM (lcCISR) && Your Unix Text file

llContinue = .T.
lnRecBegin = 1
lnRecEnd = 0
lnRecNo = 1
lnRecLength = AT(CHR(13),mtext,lnRecNo) + 1
lnRecEnd = AT(CHR(13),mtext,lnRecNo) + 1

DO WHILE llContinue
lcText = SUBSTR(mtext,lnRecBegin,lnRecLength)
* Evaluate your record (lcText) here and either discard it or
* write some or all of it to another table. When info in the
* record suggests end of file, set llContinue to .F.

lnRecNo = lnRecNo + 1
lnRecBegin = lnRecBegin + lnRecLength
lnRecEnd = AT(CHR(13),mtext,lnRecNo) + 1
lnRecLength = lnRecEnd - lnRecBegin

ENDDO

HTH

Bill
CySolutions, Medical Information Technology
You're only as good as your last
success, so . . .If it works. . .don't fix it!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform