Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
StrToFile on large text file
Message
From
18/06/2008 22:52:20
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01325149
Message ID:
01325330
Views:
21
>>I have a large (4 MB) text file that contains lines like those below. Is there a way, maybe using StrToFile(), that I can send the different blocks to separate files? I want to include the header between the dashed lines as well as the detail before the next header.
>>
>>
>>---------------------------------------------------------------------------------------------------
>>00000015 Copy this block into a file called Import.txt and put into appropriate Export directory
>>---------------------------------------------------------------------------------------------------
>>1,HIPAA,HIPAA,20080102,EXP_00D7280001.TIF
>>1,Office Notes,Office Notes,20080102,EXP_00D7260001.TIF
>>1,Prescriptions,Prescriptions,20080102,EXP_00D7160001.TIF
>>---------------------------------------------------------------------------------------------------
>>00000016 Copy this block into a file called Import.txt and put into appropriate Export directory
>>---------------------------------------------------------------------------------------------------
>>1,HIPAA,HIPAA,20080102,EXP_00D7280001.TIF
>>1,Office Notes,Office Notes,20080102,EXP_00D7260001.TIF
>>
>
>String functions such as AT(), SUBSTR(), etc. would work, but may be slow. The best results you may achieve with Windows API functions here. I saw samples a while ago on Russian website, do you want me to look them up?

This being VFP9, we don't care if aLines() returns more than 65000, so that's what I'd do. Get the whole thing into an array, then output lines one by one, inserting the headers as needed.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform