Well isn't std::string going to dynamically allocate a string according to the size of the line read in? Whereas using a char array is fixed and should be fine as long as it's big enough, right?
It seems to complete just fine with the following:
Code:
#include <fstream>
#include <string>
#include <iostream>
int main(void)
{
std::ifstream file;
std::string line;
file.open("20110803.txt");
while (std::getline(file, line))
std::cout << line << std::endl;
file.close();
return 0;
}
Still, why the heck doesn't the first code work?