Questions tagged [readline]

A library for command line editing, or a function to read one line of text.

Readline may refer either the GNU readline library, used for editing a command line; or a function or method in various programming languages which typically reads a line of text from an open file handle.

GNU readline library

The gnu readline library provides applications with an interactive command prompt with features like

  • flexible command editing
  • configurable key bindings to mimic e.g. or
  • a history of past commands

Probably the most prominent application using readline is . Both packages are maintained by the same person. Many programming languages provide bindings for this library.

readline function

Examples of readline functions or methods include

(please extend this list if you know more languages using this name)

2233 questions
47
votes
5 answers

How to use readline() method in Java?

I am beginner in Java, and I was reading the topic of giving values to variables through the readLine() method from the keyboard. The program for that is given in the book is as follows: import java.io.DataInputStream class Reading { public…
Junior Bill gates
  • 1,858
  • 4
  • 20
  • 33
46
votes
6 answers

Why do I get the "Unhandled exception type IOException"?

I have the following simple code: import java.io.*; class IO { public static void main(String[] args) { BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; while…
Roman
  • 124,451
  • 167
  • 349
  • 456
45
votes
7 answers

MSysGit Bash - how to enable Ctrl+Left / Right arrows?

Is there a way to enable Ctrl + ← / → keyboard shortcuts (go to previous / next word) in the Bash console installed with MSysGit?
Borek Bernard
  • 50,745
  • 59
  • 165
  • 240
44
votes
5 answers

Undo a file readline() operation so file-pointer is back in original state

I'm browsing through a Python file pointer of a text file in read-only mode using file.readline() looking for a special line. Once I find that line I want to pass the file pointer to a method that is expecting the file pointer to be at the START of…
MikeN
  • 45,039
  • 49
  • 151
  • 227
43
votes
3 answers

Ipython no readline available and pip install readline error

I installed ipython but it doesn't have the readline option. I first downloaded gnu readline and compiled and installed. DIdn't know whether it was a proper solution but was the first thing I thought of. It still wouldn't work to no avail with the…
J Spen
  • 2,614
  • 4
  • 26
  • 41
43
votes
3 answers

Bash variable expansion on tab complete

I'm running Ubuntu 11.04, and I'm seeing some odd behaviour when I try to use tab-completion in bash on a path that starts with a variable. If I've got TOP=/scratch, and I try to tab-complete: cd $TOP/foo it changes to: cd \$TOP/foo I'd prefer it…
sholte
  • 1,295
  • 1
  • 9
  • 11
39
votes
5 answers

Read line with Scanner

EDIT for further readers: the problem was that my input file was corrupted. I don't understand what I'm doing wrong : I was using this code : File f = new File("C:\\Temp\\dico.txt"); BufferedReader r = null; try { r = new…
Sharcoux
  • 5,546
  • 7
  • 45
  • 78
38
votes
5 answers

How to get vi keybindings to work in mysql client?

I have vi bindings working in my bash shell using set -o vi in my .bash_profile. But I can't seem to get them to work in the mysql command line client. I only get emacs style bindings. How do you do this? I also put these lines in my .inputrc, but…
dan
  • 43,914
  • 47
  • 153
  • 254
37
votes
4 answers

Python 3.6.1 crashed after readline module installed

I've compiled and installed Python 3.6.1 from source code, and run sudo pip3 install readline to install the readline module. But when I start the Python shell, it crashes whatever I enter: Python 3.6.1 (default, Mar 25 2017, 13:40:56) [GCC 5.4.0…
hsfzxjy
  • 1,242
  • 4
  • 14
  • 22
36
votes
4 answers

How to read only the first line of a file

I've been googling for a while, but I cannot find a function the read just first line of a file. I need to read first line of a text file and extract the date from it. new to perl.
Lukasz Madon
  • 14,664
  • 14
  • 64
  • 108
36
votes
9 answers

editline/history.h and editline/readline.h not found/working on macOS when trying to compile with developer tools installed already

I am working on this tutorial on building your own LISP (http://www.buildyourownlisp.com/chapter4_interactive_prompt) and for some reason when I try to compile I get this: REPL.c:4:10: fatal error: 'editline/readline.h' file not found #include…
yburyug
  • 1,070
  • 1
  • 8
  • 13
36
votes
4 answers

Python Serial: How to use the read or readline function to read more than 1 character at a time

I'm having trouble to read more than one character using my program, I can't seem to figure out what went wrong with my program. import serial ser = serial.Serial( port='COM5',\ baudrate=9600,\ parity=serial.PARITY_NONE,\ …
user2294001
  • 403
  • 1
  • 6
  • 6
35
votes
4 answers

DataInputStream deprecated readLine() method

I am on java 6. Using DataInputStream in = new DataInputStream(System.in); to read user input. When the readLine() is deprecated. What is the work around for reading user value? DataInputStream in = new DataInputStream(System.in); int num; try { …
Some Java Guy
  • 4,992
  • 19
  • 71
  • 108
32
votes
1 answer

map jj to Esc in inputrc (readline)

How can I map jj to Esc in inputrc so it gets picked up by apps using GNU Readline (python, mongoshell, ...) all works fine on zsh using: bindkey -M viins 'jj' vi-cmd-mode this is my current inputrc: set editing-mode vi set keymap vi # turn off…
jassinm
  • 7,323
  • 3
  • 33
  • 42
32
votes
1 answer

Warning: closing unused connection n

getCommentary=function(){ Commentary=readLines(file("C:\\Commentary\\com.txt")) return(Commentary) close(readLines) closeAllConnections() } I have no idea what is wrong with this function. When I run this in R, it keeps giving me…
Eva
  • 917
  • 4
  • 18
  • 23