#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
        int fd0, fd1, fd2 ;
        char buf[2][20] = { "Arminia-209", "GL-209" } ;
        fd0 = open("temp.dat", O_RDWR | O_CREAT | O_TRUNC, 0644) ;
        fd1 = open("temp.dat", O_RDWR | O_CREAT, 0614) ;
        fd2 = dup(fd0) ;
        write(fd0, buf[0], 12) ;
        write(fd2, buf[1], 6) ;
        printf("[ fd0:%d ]\n", fd0) ;
        printf("[ fd1:%d ]\n", fd1) ;
        close(fd0);
        close(fd1);
}