I have a few questions about fixed record files.  I have the following:

 

Type

   DrawCMD = Record

                GC: Byte;

                PX,PY,PZ,GX,GY,GZ,GI,GJ,R,SA,EA:Double;

             End;

Var

  DrawFile                    : File Of DrawCMD;

  Drawinfo                    : DrawCMD;

 

 

I wish to get to the end of the file and read the last record.  Currently I
am doing it like this:

 

         Reset(DrawFile);

         while not eof(DrawFile) do

            begin

               Read(DrawFile,DrawInfo);

            End;

 

When this finishes Drawinfo contains the last record of the file.  But I'm
wondering if there is a better way since it's a file of fixed records.

 

I'm also wondering if there is a way to insert a record at the beginning of
the file, or in the middle of the file without doing something like copying
the entire file to a temp file, then re-writing the entire new file in the
desired order?

 

James

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to