#include #include #include #include struct File { int descriptor; File(const char *filepath, int flags) { descriptor = open(filepath, flags); } File(const char *filepath, int flags, mode_t mode) { descriptor = open(filepath, flags, mode); } size_t send(void *msg, size_t length) { return write(descriptor, msg, length); } size_t recv(void *msg, size_t length) { return read(descriptor, msg, length); } ~File() { close(descriptor); } };