1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
10 #include <sys/types.h>
15 #define BUFSIZE (1024*1024)
17 /* Function: pwrite character '+' to <filename> at <offset> (man pwrite)
20 int main(int argc, char**argv)
30 fprintf(stderr, "Usage: %s <filename> <offset>(KB)\n", argv[0]);
35 offset = strtoul(argv[2], &end, 10);
37 fprintf(stderr, "<offset> parameter should be integer\n");
41 fd = open(filename, O_CREAT|O_RDWR, 0644);
43 fprintf(stderr, "Opening %s fails (%s)\n",
44 filename, strerror(errno));
48 /* write the character '+' at offset */
49 p_size = pwrite(fd, buf, 1, offset);
51 fprintf(stderr, "pwrite %s fails (%s)\n",
52 filename, strerror(errno));