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
6
votes
1 answer

Shortest way to open file with encoding and readLine() in Java?

What is the shortest way to open file for reading with readLine() method and with setting of it's encoding? Is the following line correct and shortest? BufferedReader reader = new BufferedReader( new InputStreamReader( new…
Dims
  • 47,675
  • 117
  • 331
  • 600
6
votes
3 answers

Readline errors prevent me running rails console

My environment is rails 3.1, ruby 1.9.2, rvm, Xubuntu 11.10. When I try to run the rails console within an app, I am getting require errors pointing at readline. So I am trying to install readline as a package within RVM, but this is the error I am…
ReggieB
  • 8,100
  • 3
  • 38
  • 46
6
votes
1 answer

python zipfile module with TextIOWrapper

I wrote the following piece of code to read a text file inside of a zipped directory. Since I don't want the output in bytes I added the TextIOWrapper to display the output as a string. Assuming that this is the right way to read a zip file line…
Lance Collins
  • 3,365
  • 8
  • 41
  • 56
6
votes
1 answer

Python + readline + auto-completion (tab): why are dashes and question-marks treated as word-separators?

Hello coders and brave GNU-readline users, A few months ago I started using Python's (2.7.1) readline module for a shell-like application I've written. The application has nothing to do with files and file-systems - it's a tailored solution for…
Amnon Grossman
  • 567
  • 1
  • 5
  • 12
6
votes
1 answer

Why does Javascript readline question method read more than one line when wrapped in a Promise

Why does Javascript readline question method read more than one line when wrapped in a Promise? The code below is supposed to simply add line numbers to the input. It works as expected if I run it and type the input at the command line. However, if…
Zack
  • 6,232
  • 8
  • 38
  • 68
6
votes
4 answers

Low performance with BufferedReader

I am processing a number of text files line by line using BufferReader.readlLine(). Two files having same size 130MB but one take 40sec to get processed while other takes 75 sec. I noticed one file has 1.8 million of lines while other has 2.1…
samarth
  • 3,866
  • 7
  • 45
  • 60
6
votes
1 answer

Change newline character .readline() seeks

Is it possible to change the newline character the .readline() method looks for while reading lines? I might have the need to read a stream from a file object that will be delimited in something other than newlines and it could be handy to get a…
tMC
  • 18,105
  • 14
  • 62
  • 98
6
votes
3 answers

Printing rows, Java heap space

I want to print each line from a huge textfile (more than 600 000 MB). But when I try the code below I get "...OutOfMemoryError: Java heap space" right before reaching line number 1 000 000. Is there a better way to handle the input rather than…
carloscloud
  • 351
  • 1
  • 3
  • 14
6
votes
2 answers

Rails3 and readline problem

I'm using rails3 for the first time (i've been using rails2 for years) inside an rvm. Trying to start the console, i get this error: require': no such file to load -- readline I've googled around and this seems to be a common problem. Most…
Max Williams
  • 32,435
  • 31
  • 130
  • 197
6
votes
3 answers

word boundaries in irb

I'm using Terminal on Snow Leopard. At the command line, if I've typed foo.bar.baz.bang.quuz.quux, when i tap option-B, it moves the cursor backward word by word -- stopping at every period, because it considers a period to be a word boundary.…
Lawrence
  • 10,142
  • 5
  • 39
  • 51
6
votes
4 answers

how to output messages to stdout on another thread while reading from stdin with GNU readline without messing up the inputs?

Sorry for the long title. I am developing a network program in C which may display messages received from network on stdout and accept user input on stdin via the GNU readline library. The problem is, when the user is typing commands on the main…
howanghk
  • 3,070
  • 2
  • 21
  • 34
6
votes
3 answers

libreadline.so.7: undefined symbol: UP

I'm having trouble building cURL and Git from sources when using GNU's Readline 7. When configuring libraries like cURL the result is: $ ./configure ... ... checking that generated files are newer than configure... done configure: creating…
jww
  • 97,681
  • 90
  • 411
  • 885
6
votes
1 answer

codecs.open(utf-8) fails to read plain ASCII file

I have a plain ASCII file. When I try to open it with codecs.open(..., "utf-8"), I am unable to read single characters. ASCII is a subset of UTF-8, so why can't codecs open such a file in UTF-8 mode? # test.py import codecs f =…
personal_cloud
  • 3,943
  • 3
  • 28
  • 38
6
votes
1 answer

“readline” when there is output at beginning of line

I am using the readline (version 6.3, default [non-vi] mode, Ubuntu 14.04) library from within my own program, running in a Terminal window (on a PC). There is a problem when there is previous output not terminated by newline when readline() is…
JonBrave
  • 4,045
  • 3
  • 38
  • 115
6
votes
1 answer

Using Node.js readline in transform streams

We have a huge text file which we want to manipulate using stream line by line. Is there a way to use Node.js readline module in a transform stream? For instance to make the whole text to use capital letter (processing it line by line)?
krl
  • 5,087
  • 4
  • 36
  • 53