I've included string: '#include<string>' but when I try to make my variable a string it doesn't want to work. Also, when i execute the program, it comes out in hex. And the weird thing is, is it doesn't matter what text file I give it. It keeps printing out '0x22fed4'... which also was strange to me. Any help would be appreciated. Mostly I need help on the string part though. It didn't even give me an error! Odd...
No... I do want the file inputted into the main function. I need to read the file in and then do some other stuff with it. I did try it though, and it just returned '0x22fed0'.....
What?!
istreams (like any other kind of input) are for input into memory. An ifstream is therefore for reading files, and viceversa.
The problem here is that you're not reading the file, you're just printing the pointer to the stream. And pointers are always printed in hex.
Remember that a stream is not a string. You have to either read the file character by character or into a buffer. Reading into a buffer is always faster.
see the istream reference for more info. http://www.cplusplus.com/reference/iostream/ifstream/