Enhancement - Edit command

- Added more fields to the edit command.
- Added a more useful slurp implementation.
- Updated advanced.html with directions on use.
This commit is contained in:
Paul Beckingham
2009-05-10 16:26:48 -04:00
parent 407ef39c54
commit 6762af8ffd
4 changed files with 76 additions and 24 deletions

View File

@@ -429,6 +429,31 @@ bool slurp (
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool slurp (
const std::string& file,
std::string& contents,
bool trimLines /* = false */)
{
contents = "";
std::ifstream in (file.c_str ());
if (in.good ())
{
std::string line;
while (getline (in, line))
{
if (trimLines) line = trim (line);
contents += line;
}
in.close ();
return true;
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
void spit (const std::string& file, const std::string& contents)
{