summaryrefslogtreecommitdiff
path: root/lib/Input.cc
diff options
context:
space:
mode:
authorPixel <Pixel>2001-09-20 23:27:01 +0000
committerPixel <Pixel>2001-09-20 23:27:01 +0000
commit8346d0774d2d1e076038db27f65f1d082a460f16 (patch)
tree132f84cf1ef45d5006a2b1d52d4d40b1e8e51abc /lib/Input.cc
Initial revision
Diffstat (limited to 'lib/Input.cc')
-rw-r--r--lib/Input.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Input.cc b/lib/Input.cc
new file mode 100644
index 0000000..f4e2602
--- /dev/null
+++ b/lib/Input.cc
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "Input.h"
+#include "Exceptions.h"
+#include "config.h"
+
+Input::Input(String no) throw (IOGeneral) :
+ Handle(no.strlen() ? open(no.to_charp(), O_RDONLY) : 0),
+ n(no) {
+ if (GetHandle() < 0) {
+ throw IOGeneral(String("Error opening file") + no + " for reading: " + strerror(errno));
+ }
+}
+
+bool Input::CanWrite() {
+ return 0;
+}
+
+bool Input::CanRead() {
+ return 1;
+}
+
+String Input::GetName() {
+ return n;
+}
+