2 * Creates a file with a hole
10 #include <sys/types.h>
12 char buf1
[] = "abcdefghij";
13 char buf2
[] = "ABCDEFGHIJ";
19 if ((fd
= creat("file.hole", 0666)) < 0) {
24 if (write(fd
, buf1
, 10) != 10) {
25 perror("buf1 write error");
28 /* offset now == 10 */
30 if (lseek(fd
, 40, SEEK_SET
) == -1) {
34 /* offset now == 40 */
36 if (write(fd
, buf2
, 10) != 10) {
37 perror("buff2 write error");
40 /* offset now == 50 */