I'm currently busy working on a script, and I made my own save-something-to-file-function:
The problem is that I want ReadFileString to put the entire content of the file in the string "oldcontent", but he also takes a lot of bytes behind the last letter...Code:procedure SaveLineToFile(filenumber:Integer; line:String); var oldcontent:String; newcontent:String; begin ReadFileString(filenumber, oldcontent, filesize(filenumber)); newcontent:=oldcontent+chr(13)+line; WriteFileString(filenumber, newcontent); end;
That means, when I write things to the file using this function, between the first and the last are a lot of strange marks, words like "TMenu" or something, and a lot of Carriage Returns (in NotePad shown as a square)....
So, how to get the exact length of the text inside the file, so I can read it properly? filesize(filenumber) apparantly gives more than the actual content, thus ruining my file...


Reply With Quote














That will make them work with notepad.


