#include #include #include int main(int argc, char *argv[]) { int res; char *name = argv[1]; unlink(name); close(open(name, O_WRONLY | O_CREAT, 0644)); close(open(name, O_RDONLY)); res = truncate(name, 1); if (res == -1) { perror("truncate"); return 1; } return 0; }