JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

os/open

core-api


    cfunction
    src/core/os.c on line 2689, column 1

    (os/open path &opt flags mode)

    Create a stream from a file, like the POSIX open system call. 
    Returns a new stream. `mode` should be a file mode as passed to 
    `os/chmod`, but only if the create flag is given. The default mode 
    is 8r666. Allowed flags are as follows:

    * :r - open this file for reading
    * :w - open this file for writing
    * :c - create a new file (O_CREATE)
    * :e - fail if the file exists (O_EXCL)
    * :t - shorten an existing file to length 0 (O_TRUNC)

    * :a - append to a file (O_APPEND on posix, FILE_APPEND_DATA on 
      windows)

    Posix-only flags:

    * :x - O_SYNC
    * :C - O_NOCTTY

    * :N - Turn off O_NONBLOCK and disable ev reading/writing

    Windows-only flags:

    * :R - share reads (FILE_SHARE_READ)
    * :W - share writes (FILE_SHARE_WRITE)
    * :D - share deletes (FILE_SHARE_DELETE)
    * :H - FILE_ATTRIBUTE_HIDDEN
    * :O - FILE_ATTRIBUTE_READONLY
    * :F - FILE_ATTRIBUTE_OFFLINE
    * :T - FILE_ATTRIBUTE_TEMPORARY
    * :d - FILE_FLAG_DELETE_ON_CLOSE
    * :V - Turn off FILE_FLAG_OVERLAPPED and disable ev reading/writing
    * :I - set bInheritHandle on the created file so it can be passed 
      to other processes.
    * :b - FILE_FLAG_NO_BUFFERING


0 examplesSign in to add an example
Loading...