#include #define __USE_GNU #include int main(void) { int fd; FILE *f; fd = open("Pfad", O_CREAT | O_EXCL | O_NOFOLLOW | O_RDWR, 0600); f = fdopen(fd, "w+"); fprintf(f, "Hallo\n"); fclose(f); /* schließt auch fd */ return 0; }