Below is the file 'fritz_this.cc' from this revision. You can also download the file.


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int
main (int argc, char *argv[])
{
    char buf[256];
    int fd = open ("/etc/passwd", O_RDONLY);
    for (;;) {
        size_t nbytes = read (fd, buf, sizeof(buf) - 1);
        if (nbytes <= 0) {
            break;
        } else {
            buf[nbytes] = '\0';
            std::cout << buf;
        }
    }
}