diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-17 01:08:45 +0100 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2011-09-17 01:08:45 +0100 |
commit | ed2b1ce7181fb21d2363b0d5ce04d7fa52aef0fa (patch) | |
tree | 12bfc100b61f80c052094ac0a95a51e254878066 /utils | |
parent | 445c62444ba3db95b7fdee80b03d313b686a6419 (diff) |
enable ramdisk scratch for per-sentence-grammars
Diffstat (limited to 'utils')
-rw-r--r-- | utils/filelib.cc | 19 | ||||
-rw-r--r-- | utils/filelib.h | 5 |
2 files changed, 20 insertions, 4 deletions
diff --git a/utils/filelib.cc b/utils/filelib.cc index a0969b1a..d206fc19 100644 --- a/utils/filelib.cc +++ b/utils/filelib.cc @@ -2,6 +2,12 @@ #include <unistd.h> #include <sys/stat.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <cstdlib> +#include <cstdio> +#include <sys/stat.h> +#include <sys/types.h> using namespace std; @@ -32,3 +38,16 @@ void MkDirP(const string& dir) { } } +#if 0 +void CopyFile(const string& inf, const string& outf) { + WriteFile w(outf); + CopyFile(inf,*w); +} +#else +void CopyFile(const string& inf, const string& outf) { + ofstream of(outf.c_str(), fstream::trunc|fstream::binary); + ifstream in(inf.c_str(), fstream::binary); + of << in.rdbuf(); +} +#endif + diff --git a/utils/filelib.h b/utils/filelib.h index a8622246..bb6e7415 100644 --- a/utils/filelib.h +++ b/utils/filelib.h @@ -113,9 +113,6 @@ inline void CopyFile(std::string const& inf,std::ostream &out) { CopyFile(*r,out); } -inline void CopyFile(std::string const& inf,std::string const& outf) { - WriteFile w(outf); - CopyFile(inf,*w); -} +void CopyFile(std::string const& inf,std::string const& outf); #endif |