Board index » delphi » Help with saving result/output data to file

Help with saving result/output data to file

Hi, I'm having problem saving the read data from a file then save the
result to another file.  I already have a working program that would read
the data from a file then print it on screen.  The file is huge and I
only want some of the data and not the rest.  Is there a way to save the
output data to file?  Any answer would be very appreciated.

Thanx  :)
Romie

 

Re:Help with saving result/output data to file


In article <Pine.SOL.3.91.960715045910.17943A-100...@winnie.freenet.mb.ca> Rommuel Cardinoza <ner...@freenet.mb.ca> writes:

Quote
>Hi, I'm having problem saving the read data from a file then save the
>result to another file.  I already have a working program that would read
>the data from a file then print it on screen.  The file is huge and I
>only want some of the data and not the rest.  Is there a way to save the
>output data to file?  Any answer would be very appreciated.

Providing your output goes to the standard text screen, you can do something
like this:

program redirect;

var
  fname : string;

function direct_to_file : boolean;

begin
  {do something here to figure out if output should be redirected}
end;

function new_output : string;

begin
  do something here to locate the name of the new output file}
end;

begin
  if (direct_to_file) then
    begin
      fname := new_output;
      close (output);  {probably not useful or necessary, but good practice}
      assign (output,fname);
      rewrite (output);
    end;
  {the rest of your program goes here...}
end.

Quote
>Thanx  :)
>Romie

--
Scott Earnest          | We now return you to our regularly scheduled |
siny...@{*word*104}space.org | chaos and mayhem. . . .                      |

Other Threads