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).
That is correct, of course.
But, take a look at his code, after reset (open read/write) he starts
writing 112 records to the file.
For the purpose of his program, the reset() is superfluous.
Yes, that's true.
But if the file is large,
it could happen that some parts of the file
survive this strange treatment.
So there is a difference in behaviour. ;-)
Nevertheless, we don't know what was intented.
Only the author can tell.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal