FAQ Database Discussion Community


C++: Re-use line printed to console [duplicate]

c++,terminal,console,formatting,output
This question already has an answer here: How to rollback lines from cout? 3 answers Edit: Thanks to user mah's comment, I found what I was looking for. I want to rollback the line, see this question. I always print information to the console using std::cout and std::endl, but...

How to get file names from command-line parameters in Python

python,input,output
I've got the following code: with open("test.txt", "r") as test, open("table.txt", "w") as table: reader = csv.reader(test, delimiter="\t") writer = csv.writer(table, delimiter="\t") for row in reader: if all(field not in keywords for field in row): writer.writerow(row) How am I able to convert it to a .py file which let you...

Displaying a zero

php,output,zero
I'm filling a template with some values being numbers, using str_replace. When a number is 0 (zero), PHP thinks it's false and write nothing. I tried every solution found on SO and the web : intval($myZeroVar) floatval($myZeroVar) strval($myZeroVar) (string)$myZeroVar ''.$myZeroVar random tests using number_format, sprintf, str_pad... NONE of these are...

Erlang: strange output formatting

xml,file,formatting,erlang,output
Windows 7 x64, Erlang-OTP 17. I wrote simple module like this: -module (somequery). -export ([fbquery/2]). fbquery(P1,P2) -> inets:start(), ssl:start(), token = "78a8shd67tyajsndweiu03hr83h19j", Encoded = {"Authorization","Basic " ++ base64:encode_to_string(lists:append([token,":",""]))}, ContentType = "application/xml", Headers = [Encoded, {"Content-Type",ContentType}], Options = [{body_format,binary}], {ok, File}=file:read_file(P1), Res = httpc:request(post, {"https://datapi.com/api/xml4-8", Headers, ContentType, File}, [], Options),...

Gradle: Get Ant Task Output

apache,ant,io,gradle,output
I have an Ant task that use the standard output to print information and I want use this output in a gradle task. I execute Ant task using following command: tasks.myAntTask.execute() Anybody know how can I get the Ant output and pass it to the gradle task?...

System.out.print . How do you get the printed output to be numbered? (Java)

java,output,system.out
So assuming I am printing out a huge record of 500 staff members. And upon printing out the record I would like it to look something like: 1. Matthew J. $USD 28.404 2. Donna M. $USD 43.254 3. Jordan D. $USD 15.532 4. 5. 6. 7. and so on...... However...with...

Read and write int pairs from file

c++,file,input,stream,output
I'm trying to read and write a sequence of int pairs from a file. The file would look something like this: 0 6 12 24 48 33 23 24 80 79 My goal is to read each pair into a struct: struct foo { int a; int b; } And...

Capturing output and exit codes in BASH / SHELL

bash,shell,output,exit
I am having trouble capturing output and exit codes inside a shell. I need to compare exit codes from 2 scripts and if they don't match I want to echo the output of my 2 scripts. What I currently have: #!/bin/bash resultA=$(./a.out 2>&1) exitA=$? resultB=$(./b.out 2>&1) exitB=$? Problem is a...

Python algorithm error when trying to find the next largest value

python,algorithm,file,output
I've written an algorithm that scans through a file of "ID's" and compares that value with the value of an integer i (I've converted the integer to a string for comparison, and i've trimmed the "\n" prefix from the line). The algorithm compares these values for each line in the...

awk to manipulate multiple files

awk,output,line,filenames
I have the following files file1 and file2 (as example) $cat file1.txt SERVICE: 1 TASK: 1 RESULT: 1 ADDITIONAL: 1 SERVICE: 2 TASK: 2 RESULT: 2 ADDITIONAL: 2 SERVICE: 3 TASK: 3 RESULT: 3 ADDITIONAL: 3 $cat file2.txt SERVICE: 1 TASK: 1 RESULT: 1 ADDITIONAL: 1 SERVICE: 2 TASK: 2...

Python regex - Optional fields in a string

python,regex,parsing,output,pager
I'm trying to teach myself python and I'm quite new to parsing concepts. I'm trying to parse the output from my fire service pager, it seems to follow a consistent pattern as follows: (UNIT1, UNIT2, UNIT3) 911-STRU (Box# 12345) aBusiness 12345 Street aTown (Xstr CrossStreet1/CrossStreet2) building fire, persons reported #F123456...

get standard output and error output in different files in C

c,pipe,output,ubuntu-12.04
I'm trying to solve a problem because I'm learning to use system calls in C. I used a Ubuntu 12.04 64bit. I have this statement: Implement a code that allows to redirect the standard out of the two commands deferred into a file (standard output) and all error output into...

Process.RedirectStandardOutput does not work

c#,process,output
I have a problem redirecting standard output of an application. It seems like this is some kind of bug in .NET. I'm running Live555ProxyServer but I don't get any output even when console which starts does have a written output. This code works with any other console application but not...

string builder and string output

java,string,output
Although the I have converted the output to a String, the output on the console is "[email protected]". Thanks. public class Solution { public String convertToTitle(int n) { if (n < 1) throw new IllegalArgumentException("Input a wrong number"); StringBuilder sb = new StringBuilder(); while (n > 0) { n--; char ch...

formatting SQLPlus terminal output (very long data_type column width)

terminal,output,sqlplus,truncate
I have a script check_table.sql: set verify off set trimout off rem set wrap off set linesize 200 select table_name, column_name, data_type, data_length from dba_tab_columns where table_name IN '&1' and owner in 'SOMEUSER'; quit; The output width is very long: TABLE_NAME COLUMN_NAME DATA_TYPE DATA_LENGTH ------------------------------ ------------------------------ ---------------------------------------------------------------------------------------------------------- ----------- ABCPROC PROC_ID...

Prevent repetition of output characters in c

c,string,character,output,repeat
Here I have a code that is to output the vowels used in a string and ignore the consonants. However it repeats the output of the vowel if that vowel is used more than once in the input string. Is there some way that I can prevent repetition of characters...

Non-scalar in Uniform output error in arrayfun. How to fix?

arrays,matlab,operators,output
I'm not sure what it means in this context. I tried adding " 'uniformoutput',false " to the end of arrayfun, but then it got upset with the "+" operator saying "Undefined operator '+' for input arguments of type 'cell'." I changed it to ".+" but got a parse error :(...

how do I writing function for this code

c,loops,output
I'm trying to write a function or method for the code. I'm really lost at how to come with the loop that print out the number born and number died in the output below. Here is my code: #include <stdio.h> char grid[10][10]; // Moved this function here int occ(int x,...

How to output elements of an ArrayList as elements are being added?

java,for-loop,arraylist,output
I am making a program that analyzes a set of student marks. The user should be able to type in a grade (for example, 92, 80, or 50) and they should appear in the textArea provided when they press the Add button. I'm using an ArrayList of Integers to add...

String format with 3 conditions: is it possible? [closed]

java,string,format,output,inline-if
I want to format my output text so it's corresponding with my counter values. For an instance, I have 3 counters and would like to output different words when it is 1, 2 and more than 2. I tried with String format, but it's only good for 2 different counters....

How to remove extra characters input from fgets in C?

c,input,output,overflow,fgets
I heard using gets() is bad in C programming and it's safer using fgets... So I am using fgets. However, I encounter a problem with fgets: I entered too much characters and somehow, it overflows. How to get rid of the extra input characters? char answer[4]; char answer2[4]; fgets(answer,sizeof(answer),stdin); printf("answer:...

Java: My statements int he Main method are printing, but not in my other methods

java,methods,input,output,println
So here's the code. It's the skeleton for a calendar program, that looks up a month and year. I'm not sure why our teacher wanted the command line arguments bit, so ignore that for now, unless it's impacting my code. At the bottom of the page, I will display the...

How to store the console output to a variable in R

r,terminal,output
In R I would like to store a console command to a variable. I have already tried with the solutions proposed in the following link but without luck: In R, is it possible to redirect console output to a variable? Here you are the command I'm using: test <- capture.output(system("pa11y...

Shows blank output while filtering alphabets in Java for a long text

java,regex,string,console,output
I'm trying to strip out only the alphabets from a long text. I have two approaches on doing it. 1. if(character falls between a-z and A-Z){ //concatenate } 2. inputText.toLowerCase().replaceAll("[^a-z]+", ""); // I just need lowercase Here's how I'm doing I/O Scanner scan = new Scanner(new File("message.txt")); String message =...

Creating a program which counts words number in a row of a text file (Python)

python,input,output,counter
I am trying to create a program which takes an input file, counts the number of words in each row and writes a string of that certain number in another output file. I managed to develope this code: in_file = "our_input.txt" out_file = "output.txt" f=open(in_file) g=open(out_file,"w") for line in f:...

How to print out an answer in decimal using python?

python,string,output
I am attempting to solve a problem on Programmr that is: Make a simple numeric calculator. It should prompt the user for three numbers. Then add the numbers together and divide by 2. Display the result. Your program must support numbers with decimals and not just integers. I have started...

Tcl How to write data to a specific line number in the middle of operating

numbers,tcl,output,line,puts
Is there any way or command in Tcl for writing in the middle of {data.txt} and also specific line number ... ? for example after writing data in text file, when I'm writing in line number 1000, is there any way for turning back to line number 20 and adding...

Python outputs a .txt file, which's format differs depending on the text editor I use to open it

python,text,output
So I have some python code taht outputs some data to a .txt file like this: f3 = codecs.open(r'C:\Users\dimrizo\Desktop\PythonData\GTFS\routes.txt','w+',"UTF-8") f3.write('route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n') f3.write('blah,blah,blah,blah,blah,blah,blah,blah,blah\n') Problem is that if I open the produced file with the simple windows text editor the text is not properly formatted. The "\n" don't even count. If I open...

Splitting string into numbers by commas and then printing ends up skipping 1 y-value

javascript,html,arrays,input,output
This code was made to take x and y as input, split the strings by the commas, convert them to an integer, and then print out the string. <body> x: <input id="xv"> <br/> y: <input id="yv"> <br/> <div id="results"> <button onclick="action()">Go</button> </div> <script> // javascript var action = function(){ //...

How to get all the output in terminal

linux,ubuntu,terminal,output,execute
I execute a program in terminal the problem is that there are a lot of numeric results and the terminal juste gave me the last results. First results were hid automatically. I search a solution to display all the results. This is the top of the terminal and i cannot...

output from loop issue in java, please help correct this

java,loops,output
My code provides the information I need it to, i just need it modified to properly print Texas Bird: Northern Mockingbird Flower: Bluebonnet sp. Currently it reads: Texas Bird: Flower: Bluebonnet sp. Flower: Bird: Northern Mockingbird Code: import java.util.Scanner; public class StateBirdAndFlowerProgram { public static void main(String args[]) { //...

References - Why do the following two programs produce different output?

c++,reference,static,output
I recently read about references in C++. I am aware of basic properties of references but I am still not able to figure out why following two programs produce different output. #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun()...

Unable to write to file Scanner try/catch Java

java,loops,output
When I run this program it is meant to write to the text file, the text file is located in the same directory as my project folder. try { Scanner inFile = new Scanner(new File ("details.txt")); while(inFile.hasNext()) { String line = inFile.nextLine(); //reads the line of text Scanner del =...

Wrtie a nested loop code segment that produces this output

loops,nested,output
Here is the output look like: 1 1 2 1 2 3 1 2 3 4 1 2 3 1 2 1 I can write it with two for loops but I don't know how to write it in just one nested loop. Is anyone can help me out? Appreciate....

mysqli::query() expects parameter 1 to be string, object given

php,mysql,mysqli,output,rows
I had saved the required steps for a parameterized string match query that outputs the subsequent rows. I had lost my files when transferring to a faulty drive. So... I'm trying to mash things together and this isn't working. $stmt = $link->prepare("SELECT id,entry,date from table WHERE string=? ORDER by Id...

My array displays only 300 elements in C++ Visual studio

c++,arrays,visual-studio-2012,console,output
I have written a code wherein I have an int array of 1000 capacity. I have randomized each element of the array. When I try to print out all 1000 of the elements. It only displays 300 lines/outputs in the console window. I wrote this in C++ and using Visual...

Writing data generated in scala to a text file

scala,data,output
I was hoping somebody could help, I'm new to scala and I'm having some issues writing my output to a text file. I have a data table and I've written some code to read it in one line at a time, do what I want it to do, and now...

C++ output files

c++,input,io,output
I am trying to export the contents of a tree with recursion. I am not getting anything but the last element exported. void inOrder(tree *root) { out.open("output.txt"); if (root != NULL) { inOrder (root->left); out << root -> item << " \t"; //This doesn't work cout << root -> item...

Strange symbols when using byte-based FileOutputStream, char-based FileWriter is OK

java,file,output
Task : Write a Java application that creates a file on your local file system which contains 10000 randomly generated integer values between 0 and 100000. Try this first using a byte-based stream and then instead by using a char-based stream. Compare the file sizes created by the two different...

MATLAB: print set of streamlines to file

matlab,file,output
I am plotting streamlines over a non uniform grid of a 2D vector field: streamlines=stream2(X,Y,U,V,startx,starty) then I plot them with: streamline(streamlines) Now, I would like to dump them to an ASCII file. Is it possible? Any clue? Many thanks...

Java - Error-message displaying incorrectly

java,eclipse,error-handling,output
This isn't a major issue, but I don't understand why this happens, so I figured I'd post it here. This is my code: do{ printMenu();//method to print menu try{ user=input.nextInt(); } catch(InputMismatchException imme) { System.err.println("Make sure to enter a number."); input.next(); continue; } switchMenu(user);//method with switch method for user input...

Need help in writing this multiplication code

c,formatting,output,multiplication,spaces
I need to show process of multiplication in output.for ex:- inputs are two numbers(say 325 and 4405) the output would be:- 325 *4405 ----- 1625 0 1300 1300 ------- 1431625 NOTE:-number of spaces should be minimum. I don't need the exact code. Just tell me which property or way I...

External tool fails to output in my app but outputs nicely in CMD screen

c#,batch-file,cmd,output,firebird
I am trying to use the GFIX tool that gets shipped with Firebird Database inside my C#/WPF Application to execute certain commands on the database. Firebird http://www.firebirdsql.org/en/firebird-2-5-3-upd1/ Gfix http://www.firebirdsql.org/manual/gfix.html To do this I use the following code: public string RunExternalExe(string filename, string arguments = null) { var process = new...

Parsing Python subprocess.check_output()

python,parsing,output
I am trying to use and manipulate output from subprocess.check_output() in python but since it is returned byte-by-byte for line in output: # Do stuff Does not work. Is there a way that I can reconstruct the output to the line formatting that it has when it is printed to...

Python: How to combine the results of for loop into one output?

python,for-loop,iteration,output
numbers = [1, 2, 3] for number in numbers: number = number * 2 #For the output I will get: 2 4 6 How do I modify my code so the results can be combined (eg. [2, 4, 6]) without using the print statement? ...

How to make my output show only whats needed with my cheque generator program for c

c,input,output
I have made a program that can output whatever numeral is inputted in to it but it will convert it to words instead of just numerals for example if you input "1234.56" it will convert it to "One Thousand Two Hundred Thirty Four Dollars and ... 56 Cents". The cents...

Why don't I get any output?

c++,class,methods,output
I am trying to write my first OOP code in C++, but for some reason I am not getting any output. I am trying to create a class that contain a method getSquare() that accept an int n and returns the number squared. Can anyone tell me where I am...

std::cerr doesn't wait for std::cout (when running CTest)

c++,output,io-redirection,ctest
The context I wrote a logger printing messages for the user. Messages with level "debug", "info" or "warning" are printed in std::cout and messages with level "error" or "system_error" are printed in std::cerr. My program is not multi-threaded. I work under Linux openSUSE 12.3 with gcc 4.7.2 and CMake 3.1.0....

Remove all non utf-8 characters from file with no output in terminal

ubuntu,utf-8,output
I am a new Ubuntu user dealing with a very large file with a few non-utf8 characters that can be safely skipped. I found another stack overflow question How to remove non UTF-8 characters from text file that gave a way to remove those characters, using the command iconv -f...

Call functions with output parameters in Parallel.For

c#,parameters,output,parallel.for
How to modify Method #2 for function with output parameters? Method #1 & Method #2 have same functionality, but gives diffrent results. I don't know why. Maybe problem with call function with output parameters or with Mpir.NET types or HashSet in Parallel.For. using System; using System.Collections.Generic; using System.Linq; using System.Text;...

Execute multiple command lines with output

c#,cmd,output
I want to perform some command lines to display the result after each input. Process p = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "cmd.exe"; info.RedirectStandardInput = true; info.UseShellExecute = false; p.StartInfo = info; p.Start(); using (StreamWriter sw = p.StandardInput) { if (sw.BaseStream.CanWrite) { sw.WriteLine("ftp"); //output sw.WriteLine("open ftp.server.com");...

Java filewriter only writing last line to file? [duplicate]

java,loops,output
This question is an exact duplicate of: Java outputting to text file? 5 answers What it currently does is reads in the data from a text file and will output them in the specified manner. When I output it to the console then it will display it into the...

How to write ''Listed Records'' in a text file?

c++,output
i am doing that project and i want to know how i can keep the records in a text file , the information that i can see in the second section (List Records). It is really urgent pleasee need help. I need to deliver my homework in 4 hours, please...

Compiling csv into one master file then output error?

csv,compilation,output
I am trying to do something for my company. Basically what I need to do is Compile all the csv in a folder into one master file. From the master file, output potential error code found in the master file to the user. The key thing of this is to...

Output department and direct reports

powershell,report,output
I am trying to create an "initial" text file that will hold a script run of all users + department + direct reports. My next step after making this file is to create another file the same way but compare it to the original to see if the department for...

simple signal code in C, some confusion

c,linux,output,signals
So here is some simple signal code in C. I have just a few questions on the concept behind this code. I don't have Linux on my computer, so please consider explaining the concept behind this code to me; I really appreciate this! What does the array int list[] store?...

How to detect whether the command output is being used in unix pipe

mysql,unix,command,pipe,output
In MySql -e option prints different formatting when used the output with pipe. Without Pipe [[email protected] commands]# $MYSQL_CONNECT_STR -e 'select 0/8' +--------+ | 0/8 | +--------+ | 0.0000 | +--------+ With Pipe -- no formatting. [[email protected] commands]# $MYSQL_CONNECT_STR -e 'select 0/8'| more 0/8 0.0000 How the mysql command detecting that...

Oracle 11G repeats output_put.put_line twice. How to solve this?

string,oracle11g,output,dbms-output
My loop is given me twice the results. As I only want it one time. What should I do? for i in 1..length(newStudentNumber) loop character := SUBSTR(newStudentNumber, i, 1); newStudentNumber := newStudentNumber || case character when 'A' then '16' when 'B' then '17' when 'C' then '18' when 'D' then...

Python: why is string not appending to every element in the list?

python,string,list,append,output
files = "a.txtb.txt" if files.find( ".txt" ) != -1: files = files.split( ".txt" ) files.remove( "" ) [ file + ".txt" for file in files ] print( files ) I'm new to python. The output I want is the list files = [a.txt, b.txt] in the end, but for testing...

A method to convert ppm to ascii art doesn't work properly

c,output,ascii-art
I wrote a program for converting a file from PPM format to ASCII art. Every pixel of the input image is converted to greyscale by calculating the average of red green and blue values ((red + green +blue)/3). The upgrade of the basic version is that I calculate the average...

Java Vector wrong output

java,vector,output
My problem is, when I add for example 3 inputs in Vector and when I display the result I only found the last output. XMLTable, Table,Column = classes cols : the vector who contain the problem Code : btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { XMLTable xt= new XMLTable();...

How do I break the string in output into 2 parts in this assembly code

assembly,output,sequence
So I want to break the break "The nth term in Fibonacci Series is " string into two: "The " and "th term in Fibonacci Series is ", print the first string, then print the value of n (say using WriteInt), then print the second string. But I can't seem...

How to get return value from a forked / spawned process in Ruby?

ruby,process,output,fork,spawn
My simple test program: pid = Process.spawn("sleep 10;date") How can I place the output (eg stdout) of the "date" command in a variable when it is available? I don't want to use a file for the data exchange....

SSRS Not Printing All Records for Dataset, but Counts Them

reporting-services,output,ssms
I have an SSRS report (see image) that looks for open discipline reports. When I run the SSRS Dataset query from SSMS, it outputs 19 records. When I print it through SSRS it only outputs 17 records, but shows a total count of 19. In the image below I've shown...

No errors in my program, but it is not printing out what i would like it to

java,output
My assignment is as follows: Create a program which will remove the first and last characters of a string. The program should then remove the next set of outside characters. The program continues in this fashion until it has hit the middle character or the middle two characters, completing a...

SQL Oracle - How to save the query output with spool on a text file?

text,save,output,spool
I'm using spool to save the output of my query into a text file but what is actually doing is save the sql commands into the file. I have: SPOOL D:\sqltestes\sql_test.txt SELECT max(column1) from my_table; SPOOL OFF; And this, is writting on the text file the "SELECT max(column1) from my_table;"...

Java program not showing output

java,output
This is the coding i have come up with for a simple car rent java program. it compiles with no error but the output is not showing, so what should i do? Please help tx. I am a java beginner. import java.util.Scanner; public class carRent { public static void main(String...

Output only numbers from print string as input

python,image,input,output,blob
I am trying to pass the x,y coordinates of a blob obtained from an image as the integers for the next part of my code. From there I hope to use these coordinates to obtain the rgb coordinates from a comparison image(at the same xy). New to code, any help...

How to save output from python like tsv

python,save,output
I am using biopython package and I would like to save result like tsv file. This output from print to tsv. for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"): print ("%s %s %s" % (record.id,record.seq, record.format("qual"))) Thank you....

I am getting 2 outputs for extremely long strings

java,string,netbeans,output
I have a program that involves parsing strings that represent nucleotides. When I use a small nucleotide string (basically, a small DNA strand) i.e. 'input' is small enough, I get one output: However, when I use a loooooooooooooooong string. e.g. 10000 nucleotides long (which I actually use) , I end...

Grunt not outputting, returning error

node.js,maven,gruntjs,output,stdout
I run a website which uses Grunt to collect all of my assets into a compiled bundle (translating Less into CSS, translating TS into JS, running tests, etc.). I recently moved to a new computer. Although my source files (including package.json, Gruntfile, pom.xml, etc.) are store in the project's Git...

Python IO: disable standard output stream and print what we want [duplicate]

python,io,output,outputstream
This question already has an answer here: Temporarily Redirect stdout/stderr 6 answers Say I have a python program composed of three lines. if __name__=“__main__”: foo( ) print “Hello” Here, foo( ) is a third-part function that outputs things to the standard output. E.g, foo( ) has only one line...

Perl: Filter AoH output

arrays,perl,hash,output
I'm trying to sort my AoH which looks like this: $VAR1 = [ { 'Name' => 'John', 'Lastname' => 'Derp', 'Organization' => 'Finance', 'OfficeNR' => '23', 'ID' => '145' }, { 'Name' => 'Kate', 'Lastname' => 'Herp', 'Organization' => 'HR', 'OfficeNR' => '78', 'ID' => '35' }, { 'Name' =>...

Capture output from ssh with expect script

ssh,output,send,expect,cisco
I want to capture the output of my expect script in a file.txt. #!/usr/bin/expect -f match_max 10000 set timeout 120 eval spawn ssh 10.0.0.0 set prompt ":|#|\\\$" interact -o -nobuffer -re $prompt return send "password\r" expect ">" send "sh cdp neighbors detail\r\r " expect ">" send "\n" sleep 5 This...

cURL live output CLI

curl,output,command-line-interface
I try to have a "live output" of a web page in a shell script ; to explain, a little example : With this "localhost/index.php" like this: <?php header('Content-type: text/html; charset=utf-8'); echo 'Start<br />'.PHP_EOL; for( $i = 0 ; $i < 10 ; $i++ ) { echo '.'; flush();ob_flush(); sleep(1);...

How do i print the output of a function in python? [duplicate]

python,printing,output
This question already has an answer here: How to add delta to python datetime.time? 2 answers calculateEndTimeWork() is a function that looks like this: def calculateEndTimeWork(): currentTime = datetime.now().time().replace(microsecond=0) endTime = currentTime + timedelta(minutes=(workDuration)) return endTime What I'd like to do now is to take the output of `calculateEndTimeWork()...

Understanding why fork gives different result in C

c,linux,output,fork
Although there are some similar questions like this and this I still cannot understand why fork gives different output with the following two codes #include<stdio.h> void main() { printf("Hello World\n"); fork(); } Gives output Hello World Where as this code #include<stdio.h> void main() { printf("Hello World"); fork(); } Gives output...

How to cout a vector of strings?

c++,string,vector,output,cout
what is the easiest way to print out a vector of strings on the console? I got something like this map < int, vector<string>> and i want to print the values to a user-given key. typemap::iterator p1; cin >> i for (pointer = map.begin(); pointer != map.end(); ++pointer) { if...

OutPut the values of a program

java,output
Here is have a program that will output the following: 3 6 3 6 7 The program is this: public class test3 { static int x=3; public static void main(String args[]){ test3 t = new test3(); System.out.println(x); int x=6; System.out.println(x); System.out.println(t.x); t.xupdate (x); System.out.println(x); System.out.println(t.x); } public void xupdate(int y){...

LC-3 output streaming random characters

output,lc3
I have been writing this program in assimbly language that encrypts or decrypts a string of text. At the end it should be simply outputting the encoded message but instead I am just getting a massive number of random characters. Anyone have any idea whats going on here? .ORIG x3000...

caching on ramdisk - finding stalest file to delete

linux,file,caching,output,ramdisk
I have a nice caching system in linux that uses a ramdisk to cache both image files and the HTML output of various pages of my website. My website is rather large and the ramdisk space required to cache everything exceeds 15GB (excluding image output) and I only have 2GB...

Request and response to other server in same page using RequestHeader

curl,vbscript,asp-classic,output
How can I show the output from other server in vbscript/ASP after I make a request for value A and B. The situation: my page request to other server value for A and B.. the server response value for A and B.. i want publish the output in same page,...

Undesired output in simple 2D array program

c,arrays,output
As a homework problem, I have to create a simple program that outputs 5 distinct cards from a standard 52 card deck. #include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> void deal(char input_array[5][4]); char deck[52][4]={"AcS","02S","03S","04S","05S","06S","07S","08S","09S","10S","JaS","QuS","KiS", "AcH","02H","03H","04H","05H","06H","07H","08H","09H","10H","JaH","QuH","KiH","AcD","02D", "03D","04D","05D","06D","07D","08D","09D","10D","JaD","QuD","KiD","AcC","02C","03C","04C",...

Unexpected output with fork() [duplicate]

c,unix,process,output,forking
This question already has an answer here: printf anomaly after “fork()” 3 answers I read somewhere that in Unix, after fork() is executed successfully, both processes will start their execution at the next statement following the fork() call. Meanwhile when I run this code in C #include <stdio.h> int...

How do you view only the final output in codeigniter?

php,codeigniter,redirect,view,output
I wanted to know if it is possible to only display the final called function's output in CodeIgniter? For example, in the below code, when the user is at the index method (/goose/index), they will see the outputs from both views 'foo1' and 'foo2'. What I would like to achieve...

Python capture command send to unix, capture output and write to file [closed]

python,file,unix,command,output
import subprocess cmd = 'ifconfig -a' p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) while True: out = p.stderr.read(1) if out == '' and p.poll() != None: break if out != '': sys.stdout.write(out) sys.stdout.flush() <<<HOW TO CMD SENT AND IT'S OUTPUT>>> file = open('outputFile.txt', 'w+') file.write(out) file.close() ...

Android Dev - Run top command output to TextView

android,android-asynctask,textview,command,output
I have been reading a lot this forum , and it help me a lot to setup my application , however , I do have another problem now , what I am trying to do is to display the "top" command output in a textview. So layout is basically two...

Why do I get wrong output?

java,output,division
I am very new to Java and am trying to write a simple code. Here is the description: Write a program that prompts the user for a number X. Print the numbers from 1 to X. However, in place of multiples of 4 print “qqqq”. In place of multiples of...

Trying to set up a simple keyboard input in a c++ program. Using variables to store true or false

c++,input,output
So I don't know why I am having trouble with this. I have looked around and I haven't found an answer that made since to me. Many said you cin, but it's hard to make a Boolean storing whether a key is pressed or not and it pauses the project...

xcode6 - how to see build command and log?

xcode,logging,build,xcode6,output
I have build errors in my xcode project (objective c), and I no longer "stumble upon" the build command string nor the build output logs. This is xcode 6.3.1. All I can inspect is a left-side panel listing errors/warnings. I want the build command and build console output to compare...

correct output for this fork concept in C

c,output,fork,atoi
So for some reason I can't get the output of this code in C, so I can only ask a few conceptual question on this code below: What does int N = atoi(argv[i]); do? is it just define integer N as an array? In the for loop, what does if...

output buffering a function parameter

php,function,output,buffering,output-buffering
I have two simple PHP functions: <? function print_txt($text) { echo $text; } function store_data($name,$data){ define($name,$data); } ?> I want the second function to store data and use it later whenever I want but when I try to put the first function as a parameter it prints it directly. E.g...

Output in Textarea from User Input

javascript,html,output
PROBLEM SOLVED I just started learning JavaScript, and I came across a problem while coding a quick tool for a game that I play. I want users to be able to input a couple of things via an HTML Form and I want the JS Script to take that input...

Need to find duplicates from an array in c++, and then put them in another array

c++,arrays,input,duplicates,output
this is my first post here and I would be very happy if you could help me. The task is - Create an array from 6 input numbers, then put the duplicated numbers in another array and then output the array with the repeated numbers. Do you have any ideas?...

output of for loop as a matrix MATLAB

matlab,for-loop,output
the following function gives as output a 3x3 matrix S=myfunction(i,3) I would like to know please if there is a way to stock the output of the following loop in a way that I can recall the matrix from each step. for i=1:8 S=myfunction(i,3) end This loop at each step...

Java: socket not getting input

java,sockets,input,io,output
So, I'm making a tic tac toe project and I'm having a problem with the network part, it's all finished, only missing the part that connects players with each other, this is the class with the problem: public class Enemy implements Runnable{ private static Socket enemy; public Enemy(Socket sock){ enemy...

Android : Force audio routing

android,output,android-audiomanager,speaker
I would like to change the sound device output in my Android app. I want to use the speaker of the phone when the headset plugged. I've tried to use setSpeakerphoneOn from AudioManager classaudioManager.setSpeakerphoneOn(true); with audioManager.setMode(AudioManager.MODE_IN_CALL); but I don't want to set the MODE_IN_CALL ! I want to stay in...

How to output smooth cspline curve as a data file

output,gnuplot,smooth
Does anybody know how to extract some data of smooth cspline curve for a given data? For instance, there is a data file which has 2 columns corresponding to x and y values. I can draw the data with smooth cpline curve by the following commands p 'data' w lp,...

C project, why the output don't come out?

c,while-loop,output
This project should print the number of divisors of a given number as input, but the cycle does not stop, making me enter numbers without stopping. #include<stdio.h> int main() { int a,d,cd; printf("Insert a number!\n"); scanf("%d",&a); while(a!=d) { if (a%d==0) cd=cd+1; d=d+1; } printf("The dividers of %d are %d",a,cd); }...

Pointer Outputs in C [duplicate]

c,arrays,pointers,output
This question already has an answer here: With C arrays, why is it the case that a[5] == 5[a]? 13 answers I am trying to understand why the following piece of code produces the output of 7. int main() { int a[] = {1, 2, 3, 4, 5, 6,...