#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>

#define FRAGMENT_SIZE 73

int main(int argc, char** argv)
{
  if (argc != 3)
  {
    printf("USAGE: seekwrite <filepath> <size>\n");
    exit(1);
  }
  
  int fd = open(argv[1], O_CREAT|O_TRUNC|O_WRONLY, 0644 );
  size_t sz = atol(argv[2]);
  char buf[FRAGMENT_SIZE];
  size_t cur;
  for (cur = 0; cur < sz; cur+=FRAGMENT_SIZE)
  {
    (void) lseek64(fd, 0, SEEK_END);
    (void) write(fd, buf, FRAGMENT_SIZE);
  }
  close(fd);
  
  return 0;
}
