length of write file input, need to remove longer old data

Sorry for the confusing subject line.
I am writing data to a text file. I can do the read/writes already.
If the original text file has “This is my data” and I will write new information into the file that is shorter, like “DATUM” then I get “DATUMis my data”. How can I overwrite all the old information, ie. delete it first, so only the new information exists?


Try this:

	set myLogFile to open for access file outputFile with write permission
	--then empty the file...
	set eof myLogFile to 0

eof stands for End Of FIle, so you are moving the pointer that marks the end of contents in the file back to zero.