legend Posted October 19, 2012 Posted October 19, 2012 Hi. When you write something to a .txt file, it's by default writting it to the end of the file, how would you write it to the top of the file instead?
kylomas Posted October 19, 2012 Posted October 19, 2012 legend, Are you talking about appending to the top of the file or overwritting the file? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
stormbreaker Posted October 19, 2012 Posted October 19, 2012 Something like: #include <Constants.au3> ;I will write a line first. FileWrite("mkish.txt", "My name is MKISH") $CONTENT = FileRead("mkish.txt") ; Now, I will add something before that line. $hFile = FileOpen("mkish.txt", 1) FileSetPos($hFile, 0, $FILE_BEGIN) FileWrite($hFile, "I wrote." & $CONTENT) FileClose($hFile) ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
legend Posted October 19, 2012 Author Posted October 19, 2012 (edited) something sort of like that the thing isthe thing is, It writes to the same line, if there already exists a line. 1.2. this line already existslMy name is MKISH3.while instead it should do it like this 1. My name is MKISH2. this line already exists3. Edited October 19, 2012 by legend
JohnOne Posted October 19, 2012 Posted October 19, 2012 FileWrite($hFile, "I wrote." & $CONTENT & @crlf) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now