Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted (edited)

something sort of like that :) the thing is

the thing is, It writes to the same line, if there already exists a line.

1.

2. this line already existslMy name is MKISH

3.

while instead it should do it like this

1. My name is MKISH

2. this line already exists

3.

Edited by legend

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...