Implementations[edit]
#include <iostream>
#include <string>
std::string line;
std::getline(std::cin, line);
std::cout<<"You entered: "<<line<<std::endl;
Common Lisp[edit]
(progn (write-string "> prompt ") (read-line))
> prompt fooey
"fooey" ;
NIL
Haskell[edit]
Prelude> do putStr "> prompt "; getLine
> prompt fooey
"fooey"
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = "";
while (str != null) {
System.out.print("> prompt ");
str = in.readLine();
process(str);
}
} catch (IOException e) {
}
# Printf.printf "> prompt %!";
read_line();;
> prompt fooey
- : string = "fooey"
s = raw_input('prompt> ')
print s
line = gets
puts line