Skip to content

Instantly share code, notes, and snippets.

@Lunaphied
Created July 8, 2016 05:54
Show Gist options
  • Select an option

  • Save Lunaphied/d36b9189413646ee028a4681a1e73ca7 to your computer and use it in GitHub Desktop.

Select an option

Save Lunaphied/d36b9189413646ee028a4681a1e73ca7 to your computer and use it in GitHub Desktop.
std::string read_file ( const char* file_path )
{
std::ifstream in ( file_path, std::ios::in );
if ( in ) {
std::string contents;
in.seekg ( 0, std::ios::end );
contents.resize ( in.tellg() );
in.seekg ( 0, std::ios::beg );
in.read ( &contents[0], contents.size() );
in.close();
return contents;
}
std::abort();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment