Hey, I have a general question. I want to write an importer class interface that will be inherited by a class that handles reading and analyzing of a certain format.
I'm wondering, is it better practice to read the file into memory and then analyze it, or is it better to analyze it straight from the ifstream? I imagine some files could be quite large, so maybe loading the entire file into memory is a bad idea?
Before, I tried reading it into a char* buffer, and then converting the data from there, but I felt I was rewriting functionality that std::ifstream already provided. What do you think?
It depends on the size of the file and what kind of operations you intend to perform on the data. In some cases, you may have no choice but to read the entire file in to perform a specific analysis.