{$i-} reset(dat);{$i+}
     if ioresult <>0 then
        rewrite(dat);
Although not wrong, the purpose of this construction is not clear to me.
In every case you will end up overwriting all data in the file.
In that case you could simply do with a  rewrite(dat). The reset(dat)
is really not necessary.
If the file exists, rewrite will effectively clear it's contents. If
the file dowes not exist, rewrite will create an empty file for you.

Although I don't see the purpose of the above code snippet there is a 
difference between existing and non-existing file:
If dat exists (and can be opened without error) then the rewrite is not done. 
So in this case dat is only opened for reading and existing data is not deleted 
(yet).
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to