JanetDocsSourcePlaygroundI'm feeling luckyCommunityGitHub sign in

getline

core-api


    cfunction
    src/core/corelib.c on line 604, column 1

    (getline &opt prompt buf env)

    Reads a line of input into a buffer, including the newline 
    character, using a prompt. An optional environment table can be 
    provided for auto-complete. Returns the modified buffer. Use this 
    function to implement a simple interface for a terminal program.


1 exampleSign in to add an example
Loading...
# in the file ex.janet

(main [_ & args]
      (print "write something and I'll echo it")
      (def x (getline))
      (print x))

# in the terminal:
# $ janet ex.janet
# write something and I'll echo it
# bla <- you wrote this
# bla
veqqqPlayground