From 8346d0774d2d1e076038db27f65f1d082a460f16 Mon Sep 17 00:00:00 2001 From: Pixel Date: Thu, 20 Sep 2001 23:27:01 +0000 Subject: Initial revision --- lib/Output.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/Output.cc (limited to 'lib/Output.cc') diff --git a/lib/Output.cc b/lib/Output.cc new file mode 100644 index 0000000..75bb437 --- /dev/null +++ b/lib/Output.cc @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "Output.h" +#include "Exceptions.h" +#include "config.h" + +Output::Output(String no, int trunc = 1) throw (IOGeneral) : + Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | O_CREAT | (trunc ? O_TRUNC : O_APPEND)) : 1), + n(no) { + if (GetHandle() < 0) { + throw IOGeneral(String("Error opening file") + no + " for writing: " + strerror(errno)); + } +} + +bool Output::CanWrite() { + return 1; +} + +bool Output::CanRead() { + return 0; +} + +String Output::GetName() { + return n; +} + -- cgit v1.2.3