Skip to content

Instantly share code, notes, and snippets.

@vinniefalco
Created November 16, 2019 20:10
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 vinniefalco/407a6ed7f2039ebcdca278437f917f05 to your computer and use it in GitHub Desktop.
Save vinniefalco/407a6ed7f2039ebcdca278437f917f05 to your computer and use it in GitHub Desktop.
inline
std::string
read_file( char const* path, boost::json::error_code& ec )
{
file f;
f.open( path, "r", ec );
if(ec)
return {};
std::string s;
s.resize( f.size() );
s.resize( f.read( &s[0], s.size(), ec) );
if(ec)
return {};
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment