The original file (MyTest1.txt) looks like:
Code: Select all
one
two
three
four
five
and the amended file (MyText2.txt) looks like
Code: Select all
five
four
three
two
one
So basically the first file is 5 lines long, and the second file is 6 lines long, the last one being empty.
Where in the code is it doing this and how can I keep the resulting file at 5 lines instead of 6?
Here's the code.. and thanks
Code: Select all
original = C:\MyTest1.txt
new = C:\MyTest2.txt
FileGetSize, size, %original% ; get original file size
VarSetCapacity(rev, size) ; preallocate space for variable
Loop, Read, %original% ; parse each line
rev = %A_LoopReadLine%`n%rev% ; reverse
FileDelete, %new%
FileAppend, %rev%, %new%