ifstream inputFile("filename.txt"); vector<char> filedata( ( istreambuf_iterator<char>( inputFile ) ), istreambuf_iterator<char>() );