Autoincrement Fields - setting to new value

This has reference to my earlier posting. I got codes for getAutoInc in one of Borland TI. To repair the table I have written the setAutoInc function which worked quite well in my application. Other members may guide for further improvement or harmful effect if any.

Thanks

// this is from borland faq
function getAutoInc(filename : string) : LongInt;
var
   mystream : tfilestream;
   buffer : longint;
begin
     mystream := tfilestream.create(filename,
                 fmOpenread + fmShareDenyNone);
     mystream.Seek(73, soFromBeginning);
     mystream.readbuffer(buffer, 4);
     mystream.Free;
     getAutoInc := buffer;
end;

// this is what I deed to set to a  new number
procedure setAutoInc(filename : string; toWhichNumber: integer);
var
   mystream : tfilestream;
   buffer : longint;
begin
     buffer := toWhichNumber;
     mystream := tfilestream.create(filename,
                 fmOpenreadWrite + fmShareDenyNone);
     mystream.Seek(73, soFromBeginning);
     mystream.writebuffer(buffer, 4);
     mystream.Free;
end;

--
Natwar Lath
Lath Consultants
ROURKELA 769012 (INDIA)
~~~ Offshore Software Development ~~~
http://lath.kalinga.com