Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find and Replace in huge text file
Message
From
27/09/2005 15:49:30
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01053411
Message ID:
01053629
Views:
25
>>>>Thre's no problem if we read to CR but what if there're more than 8192 characters between CRs?
>>>
>>>there is no more than 8192 characters / line, is LEN() function could help to determine the length returned from FGETS()?
>>
>>Sure.
>
>I found that the length of record is variant, you are right it could be > 8192 bytes, It seems that no way to handle this in foxpro right.
>I tried STRTRAN() through copying file to memo field but got "String is too big to fit" error message.
>
>Should I look to another tool or what ?

On VFP9 try this:
Text to m.lcMyText NOSHOW
AD0000123AD00

12312AD0012341AD00AD001
EndText
lcTemp1 = Sys(2015)+'.txt'
lcTemp2 = Sys(2015)+'.txt'
StrToFile(m.lcMytext,m.lcTemp1)

hIn = Fopen(m.lcTemp1)
hOut = Fcreate(m.lcTemp2)

DIMENSION aRows[1]
aRows = ''
DO WHILE NOT FEOF(m.hIn)
	FOR k=1 TO ALINES(aRows,aRows[ALEN(aRows)]+FREAD(m.hIn,0xFFFF),16)-1
		=FWRITE(m.hOut,STRTRAN(aRows[m.k],"AD00","BR77"))
	NEXT
ENDDO
=FWRITE(m.hOut,STRTRAN(aRows[ALEN(aRows)],"AD00","BR77"))
Fclose(m.hOut)
Fclose(m.hIn)
Erase (m.lcTemp1)
Modify comm (m.lcTemp2)
Erase (m.lcTemp2)
Previous
Reply
Map
View

Click here to load this message in the networking platform