To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 7780
7779  |  7781
Subject: 
Post-processing huge [POV] text files in Delphi
Newsgroups: 
lugnet.cad.dev
Date: 
Sat, 7 Sep 2002 13:45:23 GMT
Viewed: 
329 times
  
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 this problem automatically, but there
is a problem.

I have never been any good at making programs that are able to handle large
files. Afraid of making memory alloction mistakes and too lazy to learn
about it, I just the let my programs:
* read the file line by line
- edit/insert line if needed
- copy line into a temp file
* finally, if temp file is different from original file
- delete original file
- rename temp file into original file's name
* if more files to process then open next and so on

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?).


Any help would be greatly appreviated.
/Tore



Message has 3 Replies:
  Re: Post-processing huge [POV] text files in Delphi
 
You could use the 'text' type and process the reading and writing line by line manly insteat by using tstringlist, I asume. quick code for quick copy: var infile, outfile: text; line: string; assignfile(infile, 'bigfile.pov'); reset(infile); (...) (22 years ago, 7-Sep-02, to lugnet.cad.dev)
  Re: Post-processing huge [POV] text files in Delphi
 
(...) Have you considered using `diff` and `patch` to handle this? l3p ... model.pov cp model.pov model-modified.pov $EDITOR model-modified.pov diff -u model.pov model-modified.pov model.patch ... l3p ... model.pov cp model.pov model-modified.pov (...) (22 years ago, 7-Sep-02, to lugnet.cad.dev)
  Re: Post-processing huge [POV] text files in Delphi
 
"Tore Eriksson" <tore.eriksson@mbox3...wipnet.se> skrev i meddelandet news:H22M7n.J3D@lugnet.com... (...) when (...) only (...) into?). My first attempt would be to use a TStringList: with TStringList.Create do try LoadFromFile(...) ; {edit the (...) (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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR