#include <unistd.h>
#include <stdlib.h>
#include <err.h>
#include <fcntl.h>

int
main(void)
{
    int fd;

    if ((fd = open("log3", O_WRONLY)) == -1)
        err(EXIT_FAILURE, "open");

    lseek(fd, 0, SEEK_END);
    write(fd, "salam\n", 6);

    lseek(fd, 0, SEEK_SET);
    write(fd, "begin", 5);

    exit(EXIT_SUCCESS);
}
