12345678910111213141516
#include <iostream> std::string OpenFile( const std::string& filename ) { std::ifstream file(filename.c_str(), std::ios::binary | std::ios::ate ); file.seekg( 0, std::ios::end ); int length; // initialize length length = file.tellg( ); file.seekg( 0, std::ios::beg ); char* buffer = new char[ length ]; file.read( buffer, length ); file.close( ); std::string encrypted = buffer; delete buffer; return encrypted; }
#include <fstream>