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 / 7784
7783  |  7785
Subject: 
Re: Post-processing huge [POV] text files in Delphi
Newsgroups: 
lugnet.cad.dev
Date: 
Sat, 7 Sep 2002 16:10:55 GMT
Viewed: 
1536 times
  
Thanks Roland!


I think that's exactly what I was looking for.

Sometimes I wish there were a dictionary or cross-reference for people that
know what a keyword is named in one programming language. Pressing F1 is a
good thing - but only when you know which word too look for... :o/


Thanks for your super-quick response!
/Tore


In lugnet.cad.dev, Roland Melkert writes:
> 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);
> assignfile(outfile, 'bigfile.~pov');
> rewrite(outfile);
> 
> while not eof(infile) do
> begin
>    readln(infile, line);
>     //do something with line
>    writeln(outfile, line);
> end;
> 
> closefile(infile);
> closefile(outfile);
> 
> You can also look into blockread and blockwrite in combination with type
> 'file' or tfilestream for binary reads and writes. It's harder to work
> with strings then but it is much faster working with buffers.
> 
> Roland
> 
> Tore Eriksson wrote:
> > 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 is in Reply To:
  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); (...) (24 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
    

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