Unix/Linux Go Back    

UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Redirecting several outputs to /dev/stdout

UNIX for Dummies Questions & Answers

force output to screen, multiple files, multiple outputs

Thread Tools Search this Thread Display Modes
Old Unix and Linux 03-06-2009   -   Original Discussion by aplaydoc
aplaydoc's Unix or Linux Image
aplaydoc aplaydoc is offline
Registered User
Join Date: Feb 2009
Last Activity: 6 March 2009, 11:07 PM EST
Location: Montreal, Canada
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Redirecting several outputs to /dev/stdout

I have an executable that, depending on its input, outputs to either one file or several. It usually prints nothing on screen. The usual way to call this program is to specify an input and output filenames, like this:

./executable.exe -i inputfile -o outputfile

It will then try to use the output filename exactly if it needs to output to one file, or it will start appending -01, -02, -03, -04 etc... to the name and create as many outputs as needed otherwise. (These are not a combination of output and error files, they are all output files only)

I want to force output everything from it on screen. If I change my code to:

./executable.exe -i inputfile -o /dev/stdout

then it will only work if the program wants to create one output file. But I get the error

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::insert

in case it wants to output to several files. Is there another trick to force all outputs from it to print on screen??

Sponsored Links
Old Unix and Linux 03-06-2009   -   Original Discussion by aplaydoc
Corona688's Unix or Linux Image
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
Join Date: Aug 2005
Last Activity: 16 March 2018, 11:24 AM EDT
Location: Saskatchewan
Posts: 22,619
Thanks: 1,171
Thanked 4,303 Times in 3,969 Posts
Since it is the program that controls the opening and closing of its output files, no.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Redirecting part of output to stdout Legend986 Shell Programming and Scripting 2 10-17-2008 03:20 PM
implicitly redirecting stdout to a file ALTRUNVRSOFLN Shell Programming and Scripting 1 09-23-2008 03:42 PM
Redirecting STDERR message to STDOUT & file at same time vikashtulsiyan Shell Programming and Scripting 10 04-09-2008 02:34 PM
redirecting STDOUT & STDERR jshinaman Shell Programming and Scripting 9 06-22-2007 12:04 AM
Printing outputs using awk. Krrishv Shell Programming and Scripting 4 01-09-2007 06:31 AM

All times are GMT -4. The time now is 12:42 PM.