...although, considering that you'll want to overwrite what's already in the file before you write the new stuff (so that the new stuff goes before the old stuff, which will be rewritten after the new stuff), rewind() won't really be that much help.
It's generally better to write a new temporary file, and then replace the old one with it.
Open the file for reading
read it
close it
Open a new file for reading
Write new stuff
Write old stuff
close it.
Check it
delete old file
rename new file to old name
This has the extra advantage that the text file is intact and available for reading the whole time (except for the interval between the last two steps).