summaryrefslogtreecommitdiff
path: root/lib/Input.cc
blob: f4e260270870fd94dcaf8d659ddd610f9fea205f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}