#include #include #include #include #include int main (int ac, char *const *av) { const char *fname; int fd; off_t offset; if (ac != 3) error (1, 0, "usage: offset fname"); offset = strtoull (av[1], 0, 0); fname = av[2]; fd = open (fname, O_CREAT | O_EXCL | O_WRONLY, 0600); if (fd < 0) error (1, errno, "open: %s", fname); if (lseek (fd, offset - 1, SEEK_SET) == (off_t)-1) error (1, errno, "lseek: %#llx", (unsigned long long) offset); if (write (fd, "", 1) < 0) error (1, errno, "write: %s", fname); if (close (fd) < 0) error (1, errno, "close: %s", fname); return 0; }