Actually, I haven't though about using an array of strings. Thanks for bringing that up. Your proposition isn't exactly what I'm looking for as it still prints out to the stdout (cout) in C++. I want whatever's read to be fed into a char array. But your response led me to the answer I was looking for, so pat yourself on the back :D.
Lo and behold, this is what I was looking for:
TextFile *OpenFile (const char *name)
TextFile *file = new TextFile();
std::ifstream text (name);
std::cout << "Unable to open file" << std::endl << std::endl;
One thing to note before I quickly say what the above function does is that I replaced
in the TextFile class above (in my first post) with
. This lead to things being much easier!
Anway, the OpenFile function takes an outside text file, parses it line by line
, and puts it into the content variable of a TextFile object (but you can reformat the code to fit any object you're dealing with)...So in short, this function transforms an external text file into a C++ object with its contents stored within it <3. Hooray!
Thanks for the epiphany lk2019 :D!
(SIDE NOTE: For all you file streamers out there using C++, std::string is the way to go for anything that is PURE text. Forget about using char or char * --- std::string was built for that stuff :] )