JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

file/open

core-api


    cfunction
    src/core/io.c on line 141, column 1

    (file/open path &opt mode buffer-size)

    Open a file. `path` is an absolute or relative path, and `mode` is 
    a set of flags indicating the mode to open the file in. `mode` is a 
    keyword where each character represents a flag. If the file cannot 
    be opened, returns nil, otherwise returns the new file handle. Mode 
    flags:

    * `r` - allow reading from file
    * `w` - allow writing to file
    * `a` - append to file

    After one of the initial flags, 0 or more of the following flags 
    can be appended:

    * `b` - open file in binary mode (rather than text mode)
    * `+` - open file for both reading and writing
    * `n` - error if file cannot be opened instead of returning nil

    See `fopen()` (`<stdio.h>`, C99) for further details.


See also:file/closewith1 exampleSign in to add an example
Loading...
(file/open "iamfile.txt" :r)
(file/open "iamfile.txt" :w)
(file/open "iamfile.txt" :a)
jgartePlayground