Jump to content

Filewrite to beginning and end of file


TuMiM
 Share

Recommended Posts

  • Moderators

_FileReadToArray

_ArrayInsert

_ArrayAdd

_FileWriteFromArray

_FileWriteToLine()

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Hi,

;filewriteBegEnd.au3
$filename=@ScriptDir&"\test.txt"
FileDelete($filename)
FileWrite($filename, "OldLine1"& @CRLF&"OldLine2")
$s_FileInit = FileRead($filename)
FileDelete($filename)

$h_file = FileOpen("test.txt", 2);then fileopen in append  mode
FileWrite($h_file, "LinebAtStart"& @CRLF) ;write first line 
FileWrite($h_file, $s_FileInit & @CRLF); append the rest of the initial file
FileWrite($h_file, "LineEnd"); append last line
FileClose($h_file)
MsgBox(0,"","File ="& @CRLF& FileRead($filename))

Else, if it is a huge file, use tailRW , link from my sig.

Best, Randall

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...