diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Input.cc | 10 | ||||
-rw-r--r-- | src/Output.cc | 10 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/Input.cc b/src/Input.cc index 5525932..2a89fa9 100644 --- a/src/Input.cc +++ b/src/Input.cc @@ -68,18 +68,20 @@ class AsyncOpStat : public Balau::AsyncOperation { }; -Balau::Input::Input(const char * fname) throw (GeneralException) { +Balau::Input::Input(const char * fname) { m_name.set("Input(%s)", fname); m_fname = fname; +} - Printer::elog(E_INPUT, "Opening file %s", fname); +void Balau::Input::open() throw (GeneralException) { + Printer::elog(E_INPUT, "Opening file %s", m_fname.to_charp()); cbResults_t cbResults; - createAsyncOp(new AsyncOpOpen(fname, &cbResults)); + createAsyncOp(new AsyncOpOpen(m_fname.to_charp(), &cbResults)); Task::operationYield(&cbResults.evt); if (cbResults.result < 0) { if (cbResults.errorno == ENOENT) { - throw ENoEnt(fname); + throw ENoEnt(m_fname); } else { char str[4096]; throw GeneralException(String("Unable to open file ") + m_name + " for reading: " + strerror_r(cbResults.errorno, str, sizeof(str)) + " (err#" + cbResults.errorno + ")"); diff --git a/src/Output.cc b/src/Output.cc index 1688ec7..7a50b03 100644 --- a/src/Output.cc +++ b/src/Output.cc @@ -69,18 +69,20 @@ class AsyncOpStat : public Balau::AsyncOperation { }; -Balau::Output::Output(const char * fname, bool truncate) throw (GeneralException) { +Balau::Output::Output(const char * fname) { m_name.set("Output(%s)", fname); m_fname = fname; +} - Printer::elog(E_OUTPUT, "Opening file %s", fname); +void Balau::Output::open(bool truncate) throw (GeneralException) { + Printer::elog(E_OUTPUT, "Opening file %s", m_fname.to_charp()); cbResults_t cbResults; - createAsyncOp(new AsyncOpOpen(fname, truncate, &cbResults)); + createAsyncOp(new AsyncOpOpen(m_fname.to_charp(), truncate, &cbResults)); Task::operationYield(&cbResults.evt); if (cbResults.result < 0) { if (cbResults.errorno == ENOENT) { - throw ENoEnt(fname); + throw ENoEnt(m_fname); } else { char str[4096]; throw GeneralException(String("Unable to open file ") + m_name + " for reading: " + strerror_r(cbResults.errorno, str, sizeof(str)) + " (err#" + cbResults.errorno + ")"); |