Somewhat related to the previous topic, this code reads a .txt file from the hard drive, reverses its contents, and then writes the amended data back to the hard drive again (it creates a new file, it doesn't overwrite the original).
The original file (MyTest1.txt) looks like:
and the amended file (MyText2.txt) looks like
(Note the empty line underneath the 'one' in the code directly above this).
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![Wink ;)]()
The original file (MyTest1.txt) looks like:
CODE:
one
two
three
four
five
and the amended file (MyText2.txt) looks like
CODE:
five
four
three
two
one
(Note the empty line underneath the 'one' in the code directly above this).
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:
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%
Statistics: Posted by scriptor2016 — Today, 20:25