JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

getline

core-api


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

    (getline &opt prmpt buf env)

    Reads a line of input into a buffer (including the newline 
    character) showing a prompt `prmpt` if specified. Optional argument 
    `buf` specifies a buffer; if not set, a new buffer is created. 
    Provide an optional environment table `env` 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