From 76ab3f1ddc143d65e97ab301c742ad6553f1b560 Mon Sep 17 00:00:00 2001 From: Nicolas 'Pixel' Noble Date: Sun, 20 Jan 2013 19:09:14 -0800 Subject: Adding open() as an operation to Input and Output. --- src/Output.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Output.cc') 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 + ")"); -- cgit v1.2.3