In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:
http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h
http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h
Chapter 11 // Exercise 12
Reverse the order of characters in a text file. For example, asdfghjkl becomes
lkjhgfdsa. Warning: There is no really good, portable, and efficient way of
reading a file backward.
lkjhgfdsa. Warning: There is no really good, portable, and efficient way of
reading a file backward.
This one was pretty simple. I did originally do it with just an fstream as we're reading and writing the same file however, it appears an fstream, by default, appends new text rather than overwrite. I tried using ios::trunc to make it overwrite but it didn't work so I just switched to if/ostream.
No comments:
Post a Comment