Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File into memory
Message
From
16/02/2011 16:15:38
 
 
To
16/02/2011 15:53:53
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01500424
Message ID:
01500448
Views:
74
And easier to understand. I do check for files > 16,777,184 bytes and then use low-level file methods.


>And a little shorter. :-)
>
>>I second Tore's suggestion.
>>
>>We do this all the time. It is instantaneous on 50,000 segment files (the largest file I currently have to test with).
>>
>>>Hello all;
>>>I wrote a prg that opens a text file, reads each line, parses the line and writes it into another file. the program works fine but it takes to long.
>>>is there a method that i can accomplish this quicker.
>>>A file that is about 250,000 lines takes almost 2 hours to process. Below is my prg and a few lines of the data from the input file.
>>>the program creates a new line after every tilde.
>>>
>>>the parameter are the file handles created with a Fopen() and fcreate()
>>>
>>>PARAMETERS gnInFile, gnOutFile
>>>LOCAL lnEnd,lnStrt,lnLoop,lcString
>>>
>>>lnEnd = FSEEK(gnInFile,0,2) && end of file
>>>lnEndLoop = lnEnd + 1
>>>lnStrt = FSEEK(gnInFile,0) && begining of file
>>>lnLoop = 0
>>>lcString = FGETS(gnInFile,64)
>>>
>>>FOR lnLoop = 1 TO lnEndLoop
>>> * lnLoop = FSEEK(gnInFile,0,1)
>>> WAIT WINDOW "Processing byte " + ALLTRIM(STR(lnLoop)) + " of " + ALLTRIM(STR(lnEnd)) NOWAIT
>>>
>>> IF AT('~',lcString,1) > 0
>>> =FPUTS(gnOutFile,SUBSTR(lcString,1,AT('~',lcString,1)))
>>> lcString = SUBSTR(lcString,AT('~',lcString,1)+1)
>>> ELSE
>>> lcString = lcString + FGETS(gnInFile,64)
>>> ENDIF
>>>
>>> lnLoop = FSEEK(gnInFile,0,1)
>>> IF lnLoop = lnEnd AND (EMPTY(lcString) OR ISBLANK(lcString))
>>> EXIT
>>> ENDIF
>>>ENDFOR
>>>
>>>sample of character in the input file. We must create a new line at every Tilde. ~
>>>
>>>ISA*00* *00* *ZZ*341884003 *ZZ*113284753 *110215*1703*U*00401*104605543*0*P*>~GS*HC*341884003*113284753*20110215*1703*104605543*X*004010X098A1~ST*837*0001~BHT*0019*00*1046055430001*20110215*1127*CH~REF*87*004010X098A1~NM1*41*2*INTERACTIVE PAYER NETWORK*****46*341884003~PER*IC*EMDEON ADVANCED CLAIMING*TE*6159323021*EM*CLEPRODUCTIONTEAM@EMDEON.COM~NM1*40*2******46*113284753~HL*1**20*1~NM1*85*2*PRAKASHCHANDRA M. RAO, M.D., P*****XX*1326296039~N3*3130 GRAND CONCOURSE~N4*BRONX*NY*10458~REF*EI*010567880~REF*G5*0001~REF*G2*101439~HL*2*1*22*1~SBR*P**999999******ZZ~NM1*IL*1*FUENTES*JUANUTA****MI*16705189~N3*1770 BRUCKNER BLVD*13B~N4*BRONX*NY*10473~DMG*D8*19400518*F~NM1*PR*2*HERITAGE*****PI*11328~HL*3*2*23*0~PAT*21~NM1*QC*1*FUENTES*JUANITA
>>>
>>>Thank you in advance for your time and efforts.
Previous
Reply
Map
View

Click here to load this message in the networking platform