Add readStandardInput helper

This commit is contained in:
Alex Beregszaszi
2017-10-18 12:56:11 +01:00
parent 7186e142b8
commit 6f2865228c
4 changed files with 20 additions and 23 deletions
+14
View File
@@ -66,6 +66,20 @@ string dev::readFileAsString(string const& _file)
return readFile<string>(_file);
}
string dev::readStandardInput()
{
string ret;
while (!cin.eof())
{
string tmp;
// NOTE: this will read until EOF or NL
getline(cin, tmp);
ret.append(tmp);
ret.append("\n");
}
return ret;
}
void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename)
{
namespace fs = boost::filesystem;