Board index » delphi » SEEK a text file ?
cm...@qwest.net (Mike Copeland)
![]() Delphi Developer |
Sun, 17 Aug 2003 12:05:09 GMT
SEEK a text file ?Quote> I'm making a program to go with TNM (www.tnm7.com), and I have found that for can't be chosen until we (you) know some features of the true requirements. The first thing I'd want to know is, how _much_ data is in this file? It's quite possible that you could read and store the whole file in memory and access it in a variety of (fast) ways there. It's the first thing I'd try... Then, if the file is too large, there are ways to build pointers to each "record" (by reading it once and determining the byte offset of each record - to be read not as a text file but a byte/character file with typed or untyped I/o. You could create the "index/offset" table as a separate file, once the data file exists, or construct the table "on the fly" when the program starts. Yet another way is to construct a typed file from the Text data file and process it in an entirely different way. Such a decision would depend on how much dynamic access you actually need, versus how much time/effort creating a different file type would take. Of course, you can open/read the file sequentially each time you need to access a specific record, but that's very slow and clumsy. All told, you need to know more about what, why, how much, how fast, and how often you need to do the thing you ask... |