#include #include #include #include using namespace std; using MyNumberT = short; int main(){ int fd{open("binaryFile", O_RDONLY, O_CLOEXEC, O_DIRECT, O_NOFOLLOW, O_NONBLOCK)}; if (fd == -1) { perror("\tError open:"); cerr << "Did you create binaryFile?" << endl; } MyNumberT i; ssize_t size; while (size = read(fd, &i, sizeof(MyNumberT)) == sizeof(MyNumberT)) { cout << "got " << i << endl; } close(fd); return 0; }