Looks like a misuse of sizeof() to me. I don't know what you expect that to give you, but how much stack memory an fstream object takes up doesn't seem very relevant to the problem.Code:data.getline(getdata,sizeof(data));
Why not just do it the easy way:
Code:ifstream in("test.txt", ios::binary); // get length of file in.seekg (0, ios::end); size_t length = is.tellg(); in.seekg (0, ios::beg); // allocate memory vector<char> buffer(length+1,0); // read file in.read (&buffer[0],length);




Reply With Quote