Let's say that we have a random file that contains some lines of text. Let's find out how to reverse the contents of this file.
This program will not give the correct output if a random file does not exist. Please read Appendix A to learn how to create a random file.