1234
std::ifstream file("hello.txt"); char string[80]; file.getline(string, 80); std::cout << string;
12345678910111213141516171819202122
int length; char * buffer; std::ifstream is; is.open("file.text", std::ios::binary); // get length of file: is.seekg(0, std::ios::end); length = is.tellg(); is.seekg (0, std::ios::beg); // allocate memory: buffer = new char[length]; // read data as a block: is.read(buffer, length); is.close(); // deallocate the memory. delete [] buffer;