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

int main(int argc, char **argv) {
  const char *new_file;
  int fd; // Filedeskriptor

  if(argv[1] == NULL) {
      fprintf(stderr, "Usage: %s file to open\n", *argv);
      return EXIT_FAILURE;
  }
  new_file = argv[1];
  fd = open(new_file, O_WRONLY | O_EXCL | O_CREAT, 0644);
  printf("fd value is: %i\n", fd);
  if(fd == -1) {
      perror("Error opening file");
      return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}
