I am working on the first part of a project for my introductory c++ course. I am writing a program where an entire file must be read by the program. The code asks the user to enter the name of a file, and then is supposed to open that file and read every line of the file as a single string. I believe that I have the file open part right (although I may be wrong), but I cannot get it to read the file correctly. (I cout the word string to see if it is there.) Any help that you can offer is appreciated. Thanks!
Well, I'm no C++ expert (yet), although I may have your solution. I had to perform a task similar to this one, and I found this page: http://www.cplusplus.com/reference/iostream/istream/seekg/
Basically, it'll explain istream::seekg, and give you an example of loading a file to memory and outputting the data in the file. Here is an example of the program you'd write (uses practtically the exact code on the website):