Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programatically reading/writing LARGE text files
Message
De
22/08/1999 05:29:47
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
21/08/1999 21:07:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00256287
Message ID:
00256382
Vues:
22
>>>I want to build a VFP program that will determine, and allow setting about 30 variables that will be used to add, delete, or modify lines in what is effectively an INI file. The problem is that this file can range up to about 50 or 60 MegaBytes in size. I read in the VFP help file on System Capacities that the Maximum # of characters per character string or memory variable is 16,777,184 … about 1/3 the size of my file.
>>>
>>>I plan to read the file size, and use a straight forward approach (reading it into memory and manipulating it there) if it's small enough, but now I need an approach that will work with files I find that are larger than about 16 MB.

Pardon me if I'll sound stupid, but why don't we determine the length of the longest line (say, 240), create a cursor with a single field like this:

create cursor temp (row c(240))
append from the_long_file.txt sdf

then manipulate the rows in the cursor in whatever fashion you like, and dump them back, trimmed? We won't run into large memvar issues, and would have all the ease of record manipulation.

Another approach would be to keep a side table with offsets of important lines (did anyone say sections?) in this file, or possibly the lengths of the chunks, and use these as indexes into the file. Using these offsets, the file may be manipulated using LLFF - provided the lengths of the lines don't change. If they change, this won't work, of course. I've used this "byte offset into a text file" approach once on a Vax, but the file was read-only, so I needed to calculate the offsets only once, and actually indexed only the first records in a group (it was a warehouse history, sorted by item code, cobol sequential).

Anyway, I think that manipulating that big a text file will need a lot of (re)thinking. I'm actually interested to hear the details - this sounds like a strange problem.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform