CONTENTS | INDEX | PREV | NEXT

 creat

 NAME
  creat - create a file

 SYNOPSIS
  int fd = creat(file);
  char *file;

 FUNCTION
  Creates a new file and returns a file descriptor for it.  This call
  is equivalent to open(file, O_CREAT|O_TRUNC|O_RDWR);

  This is an obsolete function and should not be used.

 NOTE
  refer to the file_descriptor manual page for general information

  Unlike file pointers and file handles, the file descriptor is
  checked for validity and will simply return an error if illegal.

 EXAMPLE
  #include <fcntl.h>

  main()
  {
      int fd;

      fd = creat("T:xx");
      if (fd >= 0) {
      puts("created empty file T:xx");
      close(fd);
      } else {
      puts("unable to create T:xx");
      }
      return(0);
  }

 INPUTS
  char *file; nul terminated string that is the filename

 RESULTS
  int fd;     file descriptor if >= 0, error if < 0.