Questions tagged [readline]
A library for command line editing, or a function to read one line of text.
2,236
questions
1
vote
0
answers
39
views
Trying to execute piped commands that are taken from a readline function
I am doing a project for my school in C, which consists of building a minishell, a small version of Shell. I already have done all the parsing and can execute single commands. However, when I try to ...
1
vote
1
answer
23
views
Which is better? Integer.valueOf(readLine()) or readLine()!!.toInt()
I am learning Kotlin using codeacademy. In the Madlibs project I was asked to read an number input using readLine() from the user and then convert it to an integer. I want to know which of the two ...
0
votes
0
answers
19
views
How to statically link readline when using mingw on Linux?
I made a small CLI tool that uses readline() for completion and powerful editing capabilities. On Linux, I can use the dynamic library easily by including it as a dependency in the package manager. On ...
0
votes
0
answers
9
views
Node.js process/readline on keypress listener prevents the app from ever ending on its own
I'm trying to:
write a simple awaitable async function for a TUI node.js app
that waits for a single key press on the keyboard (without having to press Enter after)
and returns info about the key ...
0
votes
1
answer
46
views
Why Is ReadLine() Skipping certain lines
Overarching plan, make a cyoa game. Things have been working great for a while. But then errors I can't understand have been occuring. Debug.Log() print statements not working or skipping for some ...
-1
votes
1
answer
38
views
readline() method in python
I found the following on internet but I am not able to understand it. Can anybody please explain me this in an easy manner. I tried ChatGPT but it didn't help.
I know what readline() method in python ...
0
votes
1
answer
22
views
Why is readlineInterface.question() running early?
I have been working on a game called "Secret Message", wherein a player must guess a secret message hidden among several text files in a directory. My app is a node module so that I can use ...
1
vote
0
answers
52
views
Set initial position in readline
I am trying to make an iterative script in bash that takes the readline command as input.
I would like to know how I can change the position at the start of the command.
I've tried READLINE_POINT=<...
0
votes
1
answer
70
views
Double prompt when handling signals with readline function in C
I am trying to write a minimal implementation of a shell for a school project. To write such an implementation I use the readline function and I have to handle SIGINT so that I display a new prompt on ...
-1
votes
1
answer
41
views
How to get spesific index number from listof Kotlin
data class foodInfo(
val name: String,
val price: Int
)
class Foods {
private val food = mutableListOf(
foodInfo("Pizza", 50000),
foodInfo("Burger", ...
0
votes
1
answer
34
views
IRB Keyboard Shortcuts are disabled? Can these be re-enabled? What did I break?
Expected behavior:
Keyboard shortcuts using readline shortcuts like this answer.
What actually happens: Ctrl+l is pressed to clear the screen
irb
2023-08-08 20:31:17 -0600
Loaded Profile methods
irb....
0
votes
0
answers
77
views
How to avoid subshell issues with reading lines from a file? [duplicate]
"Way back in the day", mid 1990s, I had to write a C program I called "readline" to avoid the global vs local variable issue created by subshelling when one did a construct like:
...
1
vote
1
answer
27
views
Using eval() with a variable and getting a syntax error
I am trying to find the average of numbers in a file using a while loop.
I'm using readline() to get the numbers from the file and assign them to a variable, and this results in them being read as ...
1
vote
1
answer
39
views
C# Console.Read, prevent use of special characters by user
Is there a way to limit free-text when using Console.ReadLine(); to prevent the use of special characters such as / , % ,$ , #. Currently I allow all characters and then use a .Replace("[special ...
0
votes
0
answers
21
views
Duplicate carriage return when using read() of BufferedReader [duplicate]
When using read() from BufferedReader, when I press enter after typing input, the first input is taken but the next input statement is also executed, before I can type input for the next statement.
...
2
votes
1
answer
29
views
Issue with readline module in node
I have been trying to solve DSA problems using JS. So the issue I faced initially was taking user input. So went and searched and got that I can use readline module to do the same. So created an ...
2
votes
1
answer
73
views
How to highlight text using readline?
I'm trying to make a CLI that highlights text using readline. However, whenever I replace the line with a string containing ANSI codes so it can be colored, instead of the line showing up in color, ...
0
votes
1
answer
28
views
Prompt() not working in current nodejs v20.3.1
const prompt = require('node:prompt-sync');
const name = prompt('What is your name?');
console.log(`Hey there ${name}`)
anyone have solution for the following error caused by this code.
PS C:\_HCJ>...
0
votes
1
answer
79
views
What is the equivalent of Java's 'readLine()' in Progress ABL?
In Java you can read user input from the console with the following code:
String str = System.console().readLine("Enter value: ");
Is there a way to implement the same functionality in ...
-2
votes
1
answer
147
views
Whenever the text file changes a parameter in the text, create a new text file c#
I'm creating an application where every day I receive a text via URL and saved as a text file in the project folder, but every day the file is overwritten, I wanted to save a new file every day, Ex: ...
0
votes
0
answers
38
views
install: you may need to run ldconfig
I'm trying to install readline-master. The installation steps I've performed are ./configure, make, sudo make install. However, when I execute the last step, I encounter the error 'install: you may ...
0
votes
2
answers
76
views
How to only accept valid options in ReadLine (C#)
This Driving License Exam project would be my 4th code after starting to learn programming.
Program.cs
namespace DrivingLicenseExam
{
class Program
{
static void Main(string[] args)
...
0
votes
1
answer
39
views
How to AVOID completion while pasting a `tab`?
I build an executable like bash with readline. It provides completion when I type tab.
When I copy a tab and paste on it, it still does complete. That isn't I'm hoping for.
The only setting of ...
3
votes
0
answers
70
views
Supporting Shift+Enter to input multiple lines with GNU Readline
I'm using GNU Readline, mostly for its history features, to make a REPL for a programming language, but I need the ability to enter multiple lines. I'd like to support pressing Shift+Enter to enter a ...
1
vote
2
answers
54
views
Why isn't this readLine() function in C working, returns SIGTRAP?
char * readLine(){
char c;
char* line = (char*) malloc(2* sizeof(char));
if(line == NULL){
printf("MEM_GRESKA");
exit(1);
}
int sizeOfLine = 2 - 1; //-1 ...
0
votes
1
answer
51
views
How do you add a newline to the end of a string in C?
I am using the editline library to get user input and hand that input to a scanner. The scanner requires any valid input to end with a newline character to unambiguously indicate the end of the last ...
0
votes
1
answer
40
views
How to ship values from text file to convert this text file to python list with less values?
I'm studying the difference of temperature between cities and forests.
I used 6 temperatures sensors from arduino and I let the program run for about 12h. Arduino should give me values each second (I ...
0
votes
0
answers
25
views
Why does the readline module cause curses screen size not to get updated?
This simple app serves as a minimal example:
import curses
def main(stdscr):
while True:
stdscr.clear()
window_size = stdscr.getmaxyx()
stdscr.addstr(1, 1, str(window_size)...
0
votes
0
answers
33
views
Node.JS Readline not accepting inputs
I have code below that should prompt the user for their age and you type in the age and it should return with You entered: 9 and exit the program. Originally, it worked in VSCode, and then it stopped ...
1
vote
1
answer
27
views
Not getting expected o/p for readline code
Can someone please help me why the below readline code is not giving expected result ?
f=open('Python_practice/Sample1.txt','r')
while f.readline() != '':
print(f.readline(),end = '')
f.close()
...
-1
votes
1
answer
26
views
how do I read in numbers from a file and assign variables to them when the numbers have some text before them on the line in the file [closed]
I am reading in data from a text file in python. one of the lines that is being read is the following
Grid-ref= 4, 323
I want to be able to assign the 4 and 323 to variables xref and yref ...
0
votes
1
answer
39
views
How can readline be told not to erase externally supplied prompt?
I'm attempting to add readline support to ghostscript (casperscript), and it seems to be working except for one problem: when one or more characters is typed, and I backspace over them, the line is ...
0
votes
0
answers
9
views
How to pause inputing data with readline module in nodejs?
I want to pause inputing data after the first data inputed. The user should be press enter button to continue inputing data.
input0 : /* user typing /
Paused until the user press enter again
input1 : /...
0
votes
0
answers
43
views
python readline function not reading the continuously updated log file properly
I have a python script which is reading a continuously updated log file line by line. During some instances the function is reading a single line as three lines.
Below is the function which is reading ...
1
vote
1
answer
47
views
Adding a color to tcl prompt1 causes the history to be displayed incorrectly
First I added the color for the tcl prompt
proc ::tclreadline::prompt1 {} {
return "\033\[31m Test \033\[0m"
}
Then run a long command
Test 11111111111111111111
invalid command name &...
2
votes
0
answers
135
views
Looking for an alternative for rlwrap to use rman and sqlplus Oracle tools more user friendly
In our environment it is not possible to install realine and rlwrap tools which make our life easier to use Oracle CLI tools like rman and sqlplus.
I found a promising project "github.com/chzyer/...
0
votes
1
answer
35
views
How to import txt file with uneven column numbers
i would like to read and tidy a large txt file in r. The file looks like this
"X1" "ID_t.x" "Pro" "Her" "We" .....(22 column)
"1" 4 &...
0
votes
0
answers
358
views
BytesIO readline method returns bytes although there is no newline b"\n"
I am using readline method from BytesIO API. Expecting to get empty bytes but the method always returns whatever the buffer contains.
b = io.BytesIO()
b.write(b"foo") # Note that there is ...
0
votes
1
answer
96
views
GNU Readline Histfile "write_history()" Problems
I need help with the function write_history() in Readline for C.
I've been trying to make it so in a test program. For example, it would make a file, read the file (read the history found in the file),...
0
votes
2
answers
377
views
Python program to read text file then write the number of lines, words and vowels per line, and total words and vowels to a text file not working
New to python and programming in general, I'm struggling to get this program to run correctly. It has to:
Read a text file, if the file doesn't exist it has to direct the person to re-input the text ...
-1
votes
1
answer
44
views
How write file length in another file using a loop?
I am attempting to write a file which compares the amounts of permutations available for three numbers. The current script is
tmp = open("tmp_out.txt","w+")
out = open("...
0
votes
1
answer
50
views
how to read a file not from the beginning nor until the end [closed]
I'm very new to python, and I'm stumbling upon a quite trivial issue.
I have a file called myfile.txt that looks like this:
some lines
that
I don't really need
and that
can be skipped
START FROM THE ...
1
vote
1
answer
147
views
How to unit test a function that spawns child processes?
So after a LOT of trying. I've dumbed down everything to the following:
The test case
Test(minishell_loop, test_ls_exit)
{
t_minishell sheldon;
ft_bzero(&sheldon, sizeof(t_minishell));
...
0
votes
1
answer
57
views
readline only print half of the results in a csv file
As titled, I have a csv file with 6 columns. For NLP processing I need to extract the 6th column(which is a review comment column) and transform it to a list of list of words using NLP.The code below ...
0
votes
1
answer
331
views
Next line executing despite using async/await
I am trying to make a function resolve a promise before reading in subsequent lines.
What I expect is:
START
promise resolved
line1
line2
line3
etc ...
However, what I am getting is that all my lines ...
0
votes
0
answers
63
views
configure: error: --with-readline=yes (default) and headers/libs are not available | R-4.2.2
I already read about this error and solutions in some forums, but i don't know what is happening.
I have this error compiling R (using GCC 12.2.0):
checking for readline/history.h... yes
checking for ...
0
votes
0
answers
21
views
How to read a txt file line by line? [duplicate]
My txt file:
name, city, a, 5
name1, city1, b, 18
name2, city2, a, 4
def main():
try:
with open("actions.txt", "r") as infile:
lines = infile.readlines()
...
0
votes
0
answers
21
views
Am getting a weird error : GET http://127.0.0.1:5500/readline net::ERR_ABORTED 404 (Not Found)
I am new to JavaScript and HTML so i was doing some tests and I was using readline and I came across the error. I have installed everything needed so it should work. Here is my js code because thats ...
0
votes
0
answers
55
views
Is there a way to reproduce zsh tab completion with readline
As the post subject’s says, I want to know if there is a way with GNU readline library in C to reproduce the colored background like zsh does when pressing tab key.
I want to add this feature for the ...
1
vote
1
answer
147
views
How to control input echoing in non-interactive mode with readline 8.2?
As part of a school project, we have to write a simplified shell and are instructed to imitate Bash's behavior.
While trying to understand how to make the simplified shell work in non-interactive mode,...