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

"set completion-ignore-case on " ignored in ~/.inputrc

I'm attempting to set completion-ignore-case on in my ~/.inputrc, but the option seems to be ignored. When I hit tab, only case-sensitive matches are shown. Here's my ~/.inputrc: # Bash input configuration set completion-ignore-case on #Enable…
whereswalden
  • 4,819
  • 3
  • 27
  • 41
4
votes
6 answers

What is the alternative for String.contains method that is case insensitive?

While reading the line as a string from a file and string.contains("someexamplestring") will return the output of the case sensitive string. If there is "someExampleString" in line, it's not returning. How to identify a string in a…
Jagadeeswar
  • 311
  • 2
  • 5
  • 14
4
votes
2 answers

Readline.H history usage in C

I'm trying to get the last command to write inside of my C program. Right now It is just taking a command and adding it to…
user2245682
  • 53
  • 1
  • 1
  • 5
4
votes
4 answers

readline() returns bracket

I wrote some codes to get some lines from .txt like below and its keep returning lines with brackets which I did not intend. Could you help me? codes: #!/bin/python i=1 f=open("name.txt","r") while(i<=225): x=f.readline().splitlines() print("mol…
SIMONSON92
  • 73
  • 6
4
votes
1 answer

How to convert Swift 3 output of readLine() to Integer?

Please don't mark as duplicate until you read the whole thing. This is specific to Swift 3. I have functions that have parameters such as Ints, Floats, etc. I'd like to take the output of readLine() and have Swift accept the output of readLine() as…
M Gage Morgan
  • 127
  • 1
  • 1
  • 10
4
votes
1 answer

Java - get line from Random access file based on offsets

I have a very large (11GB) .json file (yeah, whoever thought that a great idea?) that I need to sample (read k random lines). I'm not very savvy in Java file IO but I have, of course, found this post: How to get a random line of a text file in…
User1291
  • 7,664
  • 8
  • 51
  • 108
4
votes
1 answer

NodeJS Readline module is trimming whitespaces when reading from a file

Is there a way to prevent Readline module from removing a whitespace that comes before the line break in the file itself? I'm parsing a non text file and those spaces are important. And why a Reader modifies the file it reads? I've tried using a…
Scillen
  • 41
  • 3
4
votes
1 answer

undo binding tab to auto-completion

In python, tab auto-completion can be enabled for raw_input with readline module: readline.parse_and_bind("tab: complete") However, how can I revert the effect of the line above? I have a program that needs tab to switch between auto-completion and…
Michael Kim
  • 689
  • 5
  • 20
4
votes
2 answers

OpenText vs ReadLines

I came across an implementation of reading a file line by line that looks like this: using (StreamReader reader = File.OpenText(path)) while (!reader.EndOfStream) { string line = reader.ReadLine(); } However personally I would do just…
Tyress
  • 3,573
  • 2
  • 22
  • 45
4
votes
4 answers

Why does StreamReader.ReadLine() return a value for a one line file with no newline?

I want to append two text files together. I have one file with a carriage return line feed at the end. Observe file A which is 28 bytes. this is a line in the file\n then I have another file which is the same thing without the new line. …
Bryan Crosby
  • 6,486
  • 3
  • 36
  • 55
4
votes
1 answer

How to parse an AWS S3 file from a Lambda function

I need some help with correctly structuring the code for process some text files using S3 buckets and a Lambda function. I want to use a Lambda function triggered by creation of a new object in the S3 bucket to read the file and to extract some data…
4
votes
6 answers

When counting the occurrence of a string in a file, my code does not count the very first word

Code def main(): try: file=input('Enter the name of the file you wish to open: ') thefile=open(file,'r') line=thefile.readline() line=line.replace('.','') line=line.replace(',','') thefilelist=line.split() …
4
votes
1 answer

readline with a default value

I am able to limit the user input to 5 characters using GNU readline: #include #include #include static int limit_rl(FILE *f) { if (rl_end > 5) { return '\b'; } return…
David Ranieri
  • 39,972
  • 7
  • 52
  • 94
4
votes
2 answers

is there any command equivalent to readline in vba?

Is there a command equivalent to readLine of Java in VBA. I want to use the text input in the immediate window and put it in a variable. Is it possible?
Emi
  • 484
  • 2
  • 16
4
votes
0 answers

How do I continuously read and parse high speed SerialPort data

I am trying to write C# code that takes serialport data from a high speed GPS device and parse the data to grab coordinates. The problem with this compared to other serial GPS devices is that it spits out 5-6 lines of data every 100 milliseconds…
Kevin Tam
  • 51
  • 1
  • 4