Re: Newb code trouble

From: lepton2 (lepton2_at_verizon.net)
Date: 08/21/04

  • Next message: Jamie: "Re: reading half a byte (4 bit numbers)~"
    Date: Sat, 21 Aug 2004 14:40:27 GMT
    
    

    Dave wrote:

    > procedure TForm1.Button3Click(Sender: TObject);
    > Var Logfile : Tstringlist;
    ...Clip
    ====================================================
    Dave,
    Jamie was right in that you COULD use file access constructs; J
    French was correct that a filestream COULD be used;Bruce is
    correct to point out that you SHOULD use Try..Finally blocks and
    that you SHOULD use caution using the "With" construct. ALL of
    those points are valid, but as a newb you might not be ready to
    learn those yet; maybe you just need to see your code and its
    inherent logic restated in a CORRECT AND SIMPLIFIED form.

    procedure TForm1.Button3Click(Sender: TObject);
    Var Logfile : Tstringlist;
    begin
      Logfile:=Tstringlist.Create;
      with Logfile do
        begin
          if Fileexists('c:\Logdcm.dat') then loadfromfile('c:\Logdcm.dat');
          add(Edit1.Text);
          SaveToFile('c:\Logdcm.dat');
        end;
      Logfile.Free;
     end;

    DBM.

    =============================================================
    *:='programmers'

    Why cant * get acting jobs? Because they're all
    typecast.
    What vodka do * drink? Absolute!
    How do * get rich? They Acquire an
    Inheritance from their Ancestors!
    Why didn't the * query the prison database He didn't want to get a
    criminal record!
    What is the * favorite movie monster The Blob!


  • Next message: Jamie: "Re: reading half a byte (4 bit numbers)~"