Subject:
|
Re: Post-processing huge [POV] text files in Delphi
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Sat, 7 Sep 2002 16:17:00 GMT
|
Viewed:
|
408 times
|
| |
| |
"Tore Eriksson" <tore.eriksson@mbox325.swipnet.se> skrev i meddelandet
news:H22M7n.J3D@lugnet.com...
> [...]
> I find this method quite fool-proof, but not very effective, especially when
> processing POV files that often reach the size of 12 Mb and more. But I only
> know how to do this in C; in Delphi I use ReadFromFile and SaveToFile that
> are extremely easy to use but tend to fail when files are larger that 64k
> (or was it even 32k depending on with object the file content is read
into?).
My first attempt would be to use a TStringList:
with TStringList.Create do
try
LoadFromFile(...);
{edit the lines, insert, delete and so on...}
SaveToFile(...);
finally
Free;
end;
I use this method for all sizes of files, and have never been bitten by a
size limit. Of course, you shouldn't try it on files bigger than available
RAM, as it will get quite slow (but still works up to the size of your
virtual memory). The 32k(64k) limit occurs only when reading directly to a
Windows control (ListBox, Memo, etc).
Next step would be TStream (TFileStream), but you can't insert into it, so
you'll have to do it with two streams, just like your two-file approach.
You can also read the whole file into *one* string! And then work like the
two-file case, but on two strings in memory.
OTOH, perhaps a string processing language like AWK would be better suited
for your purpose?
--
Anders Isaksson, Sweden
BlockCAD: http://user.tninet.se/~hbh828t/proglego.htm
Gallery: http://user.tninet.se/~hbh828t/gallery/index.htm
|
|
Message has 1 Reply: | | Re: Post-processing huge [POV] text files in Delphi
|
| (...) Now that you mention it, I remeber you said that when we met at your home. Is there really any point trying to teach me something? :o) (...) In a way, that makes sense. Many POV statement span over multiple lines. (...) I'm having a look at it (...) (22 years ago, 8-Sep-02, to lugnet.cad.dev)
|
Message is in Reply To:
| | Post-processing huge [POV] text files in Delphi
|
| Very often, I have just changed a little detail in a model converted to POV by L3P. Then after I run the model through L3P again, I have to manually set all the modifications not handled by L3P arguments again. I try to make a utility program to fix (...) (22 years ago, 7-Sep-02, to lugnet.cad.dev)
|
8 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|