Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
StrToFile on large text file
Message
From
19/06/2008 11:14:59
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:
01325461
Views:
21
>>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.
>
>Still I would expect this be slow on a big (huge) files.

Yes, but 4 MB is not big :).

On a file that's about 2M long,

? SECONDS(), ALINES(aa, FILETOSTR("my_long_program.prg")), SECONDS()

returns 47069 lines in 0.335 seconds. Since I didn't have a larger file at hand,

? SECONDS(), ALINES(aa, REPLICATE(FILETOSTR("my_long_program.prg"),4)), SECONDS()

gives only .377 seconds (probably due to caching), and I had about a dozen other windows open and my machine is no Ferrari. So it's only the time it takes to fwrite() everything, which is a low level operation which is as fast as it gets.

back to same old

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

Click here to load this message in the networking platform