Next: , Up: posix fd   [Index]


4.13.1 Opening and closing

Function: open pathname flags mode

Interface to the C function open(), (libc)open. Open a file descriptor for the file system entry pathname; flags and mode must be fixnums. If successful return a fixnum representing the file descriptor, else raise an exception.

Example:

#!r6rs
(import (vicare)
  (prefix (vicare posix) px.)
  (vicare platform constants))

(define fd
  (px.open "name.ext"
           (fxior O_CREAT O_EXCL O_RDWR)
           (fxior S_IRUSR S_IWUSR)))
Function: close fd

Interface to the C function close(), (libc)close. Close a file descriptor represented by fd, which must be a fixnum. If successful return unspecified values, else raise an exception.