Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@beakr
Created February 23, 2014 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beakr/9176722 to your computer and use it in GitHub Desktop.
Save beakr/9176722 to your computer and use it in GitHub Desktop.
Always keep this Gist close to your heart. You will love it forever.
char * readfile(const char * f)
{
ifstream in(f, std::ifstream::binary);
in.seekg(0, in.end);
int size = in.tellg();
in.seekg(0);
char * buf = new char[size];
in.read(buf, size);
return buf;
delete[] buf;
in.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment