libscio/fdstream.cpp

44 lines
635 B
C++
Raw Normal View History

2020-04-25 17:42:26 +02:00
//
// fdstream.cpp
// libscio
//
// Created by Bob Polis at 2020-04-25
// Copyright (c) 2020 SwiftCoder. All rights reserved.
//
#include "libscio.hpp"
#include <unistd.h>
sc::io::fdostream::~fdostream() {
close();
}
void sc::io::fdostream::close() {
2020-04-25 17:42:26 +02:00
if (_outbuf.fd() != -1) {
::close(_outbuf.fd());
2020-04-25 18:13:53 +02:00
_outbuf.fd(-1);
2020-04-25 17:42:26 +02:00
}
}
sc::io::fdistream::~fdistream() {
close();
}
void sc::io::fdistream::close() {
2020-04-25 17:42:26 +02:00
if (_inbuf.fd() != -1) {
::close(_inbuf.fd());
2020-04-25 18:13:53 +02:00
_inbuf.fd(-1);
2020-04-25 17:42:26 +02:00
}
}
sc::io::fdstream::~fdstream() {
close();
}
void sc::io::fdstream::close() {
2020-04-25 17:42:26 +02:00
if (_iobuf.fd() != -1) {
::close(_iobuf.fd());
2020-04-25 18:13:53 +02:00
_iobuf.fd(-1);
2020-04-25 17:42:26 +02:00
}
}