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

Storing multiple user inputs in R using readline

I am using the readline() function to get input from a user and saving that input into a vector. your_current_guess=readline(prompt="odds or evens? ") How would I have a vector that saves each input from the user instead of only the most recent…
0
votes
2 answers

How to calculate the surface of a square with user entries in C#?

I would like to write a program where the user will be asked for numbers which will be used to calculate the surface of a square. But I don't know how to "use" the entered numbers in my methods. Thank you Here is what I have done so far static void…
0
votes
1 answer

New line is not recognized on different computer

I'm using Javascript (specifically in TestComplete) to read a file. On one computer, this works exactly as I expect it to and each line is printed individually. On a different computer using the exact same XML file, this is all read as one line. It…
Cody Harness
  • 1,116
  • 3
  • 18
  • 37
0
votes
1 answer

Python CSV touble

I writing a code that reads a very large CSV file line by line with readlines(). I call the function with a global variable and access that variable to search for specific words and count the number of times it comes up in the file. def…
0
votes
0 answers

How can i replace BufferedReader readline() by read()

I have this code : try { bufferedReader = new BufferedReader(new FileReader(new File(filePath))); String currentLine; int numLine = 0; while ((currentLine = bufferedReader.readLine()) != null) { …
Orland
  • 13
  • 4
0
votes
1 answer

Problem with range() function when used with readline() or counter - reads and processes only last line in files

Have two simple 20 line text files. Current script below only reads line 20 in both, runs main 'context_input' process without errors, then exits. Need to apply same process to all lines 1-20. Same result if using counter with import sys.…
Ron
  • 1
  • 1
0
votes
0 answers

How to convert each line to variables in CLI?

I have a this code in my Linux server to retrieve some data from a remote URL: curl domain.com/info.php > test.txt The test.txt file will be like this after execution of above code: customer_domain 1234 api_key Now, I need to read each line of…
Mohammad Saberi
  • 12,864
  • 27
  • 75
  • 127
0
votes
2 answers

How do I end the program once the last line of the text is reached?

I've written this code with the aim of exiting the code once the last line is reached and I've tried using the commented code but it only prints every alternating line. try: a = sys.argv[1] with open(a, 'r') as f: …
ter123
  • 21
  • 7
0
votes
1 answer

How to add a readline function for a PATHINFO() (extension)

When i put a file inside the readline, i want that the pathinfo() show me its extension. But i want to add this code inside my function. Let me show you my code : function returnIcon($parts) { $extension = $parts['extension']; return…
user13328799
0
votes
1 answer

Reading CSV file and storing data in Java

I have a task which requires me to read a CSV file in Java. I have done reading it but I think I do not store them in the way I wanted which enable me to access them on the later tasks such as analyzing some of the data, buidling a graph etc. The…
boonboon93
  • 41
  • 4
0
votes
1 answer

How do I suppress duplicate lines in node?

I am making a Kahoot Bot and I want it to have a feature where I can have the user to choose an answer. I am using readline to grab user input (example code of what I am doing): var rl = require("readline").createInterface({ input:…
lemons
  • 1
  • 4
0
votes
2 answers

How to write a text prompt in Nim that has readline-style line editing?

readLine() doesn't support line editing and recalling previous commands, eg: while true: var name: string = readLine(stdin) echo "Hi, ", name, "!" Has no editing. But if I compile that and wrap it in rlwrap: $ rlwrap read_test It works as I…
0atman
  • 3,298
  • 4
  • 30
  • 46
0
votes
2 answers

R | readLine | read file containing numbers only (separated by whitespace)

I am reading a file where in each line there are numbers separated by spaces. I am using following command f <- file("stdin") on.exit(close(f)) L <- strsplit(readLines(f), "\n") T1 <- as.numeric(unlist(strsplit(L[[1]], split = "\\s"))) # to read…
0
votes
0 answers

Reading from an updating chatlog.txt until a particular line appears

I have just recently started coding in python and found myself overwhelmed when it came to creating this script. So, I have a chatlog.txt file that is constantly being updated and I want to make it so that whenever a new line that contains "Apple"…
TheBig89
  • 1
  • 1
0
votes
2 answers

Changing lines in specific file types in subdirectories

I am trying to create a script that will search through a user input file path and open all the .cix file type and replace line 27. What I have so far works on individual folders opening the files within one at a time and modifying the desired line.…
IHamilton
  • 35
  • 6
1 2 3
99
100