Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions
Reverse the order of lines in a text file while preserving the contents of each line (view source)
Revision as of 22:54, 28 November 2021
, 2 years agoReverse the order of lines in a text file while preserving the contents of each line en FreeBASIC
Catskill549 (talk | contribs) (added AWK) |
(Reverse the order of lines in a text file while preserving the contents of each line en FreeBASIC) |
||
Line 131:
"Diplomacy is the art of
</pre>
=={{header|FreeBASIC}}==
<lang freebasic>open "text.txt" for input as #1
dim as string textEnt, textSal()
dim as integer n, linea = 0
do while not eof(1)
line input #1, textEnt
linea += 1
redim preserve textSal(linea)
textSal(linea) = textEnt
loop
for n = ubound(textSal) to 1 step -1
print textSal(n)
next n
close #1
sleep</lang>
{{out}}
<pre>
--- Will Rodgers
until you can find a rock."
saying 'Nice Doggy'
"Diplomacy is the art of
</pre>
=={{header|Go}}==
|