FAQ Database Discussion Community


How can i tell my Program to “re-do” diffrent Actions (chosen by User-Input) after it is done, till the do-while Requirement is set?

c#,input,console,readline
Im just a Beginner in C# and im working on a Console Application, I want the Program to be able to read the Input of the User and execute the Orders until he has 0 HP. Its basicly gonna be "Fighting-Game". My Problem now, I can only ask for the...

how to turn multiple tables in a text file into one table with an additional column?

r,readline
My text file "myfile.txt" contains many tables with the same columns (name, age, weight, profession). It looks like: table_ID 001 John | 38 | 165 | Computer scientist Mary | 22 | 122 | Student table_ID 002 Patric| 44 | 105 | Teacher Kim | 56 | 155 | Salesman...

strange inputrc behavior: characters succeeding '1' being pushed to the end of the line

linux,bash,readline
I type in IP addresses frequently for my work. Most are on the same network, so it is fairly repetitive. I want to bind F1 to the repetitive part of the IP, so I can just smack that and type in the rest. After identifying F1, I wrote a test...

C# read more lines in text box and edit each line [closed]

c#,textbox,readline
I have a question? Here i have the code that reads from one textbox one line. How can I make it to work, that it will read more lines? Not just one. This code activate with click: private void b_Execute_Click(object sender, EventArgs e) { string one1 = "NO"; string one2...

Reading files in c# with filestream and streamreader

c#,byte,filestream,streamreader,readline
I have a file, which contains data, I want to read it as byte[] and divide into 3 blocks. First line might be read as string, then 2nd block, might be 1-3 length of lines and all left bytes as block 3. I was wondering, how can I get that...

Python Read Character by Character without printing

python,string,readline
Am fairly new to python, We have an interesting situation. We want to read a char from stdin, store the char, and display another char. example: the user enters 'c', the code is expected to save 'c' and print 'v' (instantaneously) although getpass.getpass saves the input but it print nothing....

How do I read next line with BufferedReader in Java?

java,bufferedreader,readline
I have a text file. I want to read it line by line and turn it into an 2-dimensional array. I have written something as follows: BufferedReader br = new BufferedReader (new FileReader ("num.txt")); String line = br.readLine(); while( line != null) { System.out.printf(line); } This turns into an infinite...

read all lines in text file with separator

c#,text-files,readline
I have a file with this content : 1,2,3,4,5# 1,2,3,4,5# How can i read all lines using readline ?the important thing is i need to separate the values in each line ,i mean the first line's values 1,2,3,4,5 should be separated . Suppose i have an array named myarray that...

Data stored in different lines on a file, how to load them as parameters to a class?

java,initialization,bufferedreader,readline
I'm trying to do a small sentence translator, each sentence has one or more translations that will be loaded from a file formatted like this: EN – english sentence 1 IT – italian translation 1 EN – english sentence 2 IT – italian translation 1 IT – italian translation 2...

Python skip first line .readlines( )[1:] not working?

python,python-2.7,csv,readline
If I remove [1:], if works fine and prints all data. f = open("test.csv", "r") lines = f.readlines() f.close() print lines result: ['title1,title2\raa,aaaa\rbb,bbbb\rcc,cccc'] but if I try to skip the first line by adding [1:] f = open("test.csv", "r") lines = f.readlines()[1:] f.close() print lines it prints an empty array...

Setting GNU readline prompt to NULL causes custom prompt to be overwritten

c,readline
I am writing a custom shell in c, and have encountered a strange little bug, which can be seen in the following testcase: #include <stdio.h> #include <stdbool.h> #include <readline/readline.h> #include <readline/history.h> int main(int argc, char **argv, char **env) { while(true) { fprintf(stdout, "input: "); char *line = readline(NULL); if(line) {...

Python script to read a line that has white space and return value

python,whitespace,readline
I need to read the line which has the const keyword and return version as the value. Content in the Version.php file final class Version { /** * The current Piwik version. * @var string */ const VERSION = '2.0.3'; } Here is the code I have written but its...

Java read large text file with separator

java,file,readline
I'm trying to read a large text file in the form of: datadfqsjmqfqs+dataqfsdqjsdgjheqf+qsdfklmhvqziolkdsfnqsdfmqdsnfqsdf+qsjfqsdfmsqdjkgfqdsfqdfsqdfqdfssdqdsfqdfsqdsfqdfsqdfs+qsfddkmgqjshfdfhsqdflmlkqsdfqdqdf+ I want to read this string in the text file as one big java String. Is this possible? I know the use of the split method. It worked to read it line by line, but what I...

Python readline module on OS X lacks set_pre_input_hook

python,osx,readline
I added the following code to my python startup script. It works great on Windows 7 after I install pyreadline via pip, but it's not working on OS X Yosemite (10.10.2 to be specific). import readline def atPrompt(): import readline global freshPrompt if freshPrompt: freshPrompt = False last = readline.get_history_item(readline.get_current_history_length())...

Rails server giving Readline support error

ruby-on-rails,ruby,ruby-on-rails-4,readline
I'm new to Ruby on Rails and I'm trying to start the RoR server. But when I run the command rails server it gives me the following error: Sorry, you can't use byebug without Readline. To solve this, you need to rebuild Ruby with Readline support. If using Ubuntu, try...

Control characters in Python shell

python,shell,readline
I have a problem when I am using Python interactive shell. I love emacs-style key bindings, but when I typed <ctrl> A or <ctrl> K, it echo ^A or ^K. Like: :)[12:16]root:~ # python Python 2.7.9 (default, May 15 2015, 01:13:44) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2 Type...

while(getline(myReadFile, temp, ':')) executing one iteration too many causing out of bounds on vector

c++,readline,readfile
I have a question on std::readline(istream, string, delimiter). I am trying to read in a file and store the data in a struct and add it to a map. That I have gotten to work. However my while loop iterates one loop too many causing my vector to have no...

R - how to replace values in a subset of a vector

r,vector,replace,subset,readline
I have a bash script that is basically a series of commands to download a bunch of climate files. Among many other information on the script, lines 28 to 1027 determine the actual files that should be downloaded. See my file: # point to file file <- 'https://dl.dropboxusercontent.com/u/27700634/wget-ESG-files.sh' # read...

How can I effectively test my readline-based Python program using subprocesses?

python,unit-testing,python-3.x,subprocess,readline
I have a Python program, which, under certain conditions, should prompt the user for a filename. However, there is a default filename which I want to provide, which the user can edit if they wish. This means typically that they need to hit the backspace key to delete the current...

while reading lines from file, java program is reading one single line into two different lines in some cases [duplicate]

java,file,readline,tweets
This question already has an answer here: Java read large text file with separator 6 answers I need to read lots of text files to develop my project. Each file contains tweets and retweets of a person. I wrote simple java code to do that. I also tried to...

comparing and counting items in python (while loop)

python,while-loop,readline,counting
I'm trying to make a script that: Reads in a line of text line-by-line from a file For each line, see if any phrases from an array (animal_keywords) are there If there is, increase the animal count by 1 If there isn't, increase the other count by 1 Print the...

A way to condense multiple readlines?

c#,readline
Im pretty new to programming so i dont know much myself other than what we've done in my into c# class so far but i've looked pretty much everywhere for a way to condense readlines so that the program will read many inputs in a row without having to code...

QT reading file line by line

c++,qt,readline,qtextstream
I need to read the contents of a file line by line. Sample.txt: #define <tabspace> temp <tabspace> 10 Code: QFile file("D:\Sample.txt"); QTextStream in(&file); QString str_Line = in.readLine(); str_Line contains #definetemp10 How to read the line with including the tab spaces? can any one please help me out?...

Buffered Reader read text until character

java,file,while-loop,bufferedreader,readline
I am using a buffered reader to read in a file filled with lines of information. Some of the longer lines of text extend to be more than one line so the buffered views them as a new line. Each line ends with ';' symbol. So I was wondering if...

inputrc: menu-complete-backward doesn't work on Mac OS X?

linux,osx,bash,readline
My .inputrc is exactly the same on my linux box as it is on my macbook pro, running Yosemite: Control-n: menu-complete Control-p: menu-complete-backward On Linux, it works flawlessly; however, on my macbook pro, only Control-n works, but Control-p doesn't cycle backward or do anything. In fact, menu-complete-backward doesn't even get...

Android http request readline

java,android,httprequest,bufferedreader,readline
I was trying to readline through http request of the source code of the web page. My purpose was to read an integer value (price) from the result. I'm using bufferedReader to readline. I had no clear idea on which method could store the data I wanted. Below is the...

How to configure the Racket interpreter to support command history?

racket,readline,input-history
I've just set up Racket and have been trying out the interpreter. However, I can't seem to go up and down the command history using the arrows (or Ctrlp/Ctrln for that matter) or use Ctrlr to search through it. Is that even supported? Can I build it with that feature...

How to get Bash version in .inputrc

bash,readline
I'm trying to set a keymap in my .inputrc file, but I want it to be set/executed only when I'm running a bash version >= 4.3 since I'm working on different machines with different bash versions. Currently my .inputrc has: set editing-mode vi $if mode=vi set keymap vi-insert "jk":vi-movement-mode $endif...