io: add std::string overload to slurp

This commit is contained in:
Danny Robson 2016-10-07 18:08:41 +11:00
parent a78ed2b879
commit 98732179a7
2 changed files with 9 additions and 0 deletions

8
io.cpp
View File

@ -70,6 +70,14 @@ util::slurp (const char *path)
} }
//-----------------------------------------------------------------------------
std::vector<char>
util::slurp (const std::string &path)
{
return slurp (path.c_str ());
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::vector<char> std::vector<char>
util::slurp (FILE *stream) util::slurp (FILE *stream)

1
io.hpp
View File

@ -39,6 +39,7 @@ namespace util {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/// Reads an entire file into memory. /// Reads an entire file into memory.
std::vector<char> slurp (const char *path); std::vector<char> slurp (const char *path);
std::vector<char> slurp (const std::string &path);
std::vector<char> slurp (FILE *); std::vector<char> slurp (FILE *);