I have written the below program to create a file containing holes but I am getting an error in lseek() as below:
Error in lseek <22> : Invalid argument
I just want to write "1" at first and "2" at 100th offset. I have tried it with SEEK\_END also, but no success

```
#include<stdio.h>
#include<errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>

int main(void) {

    int fd = -1;
    int rc = -1;
    char *buff = "1";
    char *buff_end = "2";
    char *err;

    fd = open("hole_file", O_CREAT | O_RDWR | O_TRUNC, 0644);

    if (fd == -1) {
        printf("\n Error in open() !!!");
        return (-1);
    }

    rc = write(fd, buff, sizeof(buff));
    if (rc == -1) {
        printf("\n Error in writing at start location <%d>", errno);
        close(fd);
        unlink("hole_file");
        return (-1);
    }

    rc = lseek(fd, SEEK_CUR, 100);
    if (rc == -1) {
        err = strerror(errno);
        printf("\n Error in lseek <%d> : %s\n", errno, err);
        close(fd);
        unlink("hole_file");
        return (-1);
    }

    rc = write(fd, buff_end, sizeof(buff_end));
    if (rc == -1) {
        printf("\n Error in writing at 100th offset <%d>", errno);
        close(fd);
        unlink("hole_file");
        return (-1);
    }

    close(fd);

    return (0);
}

```