stdout

issue with FILE

I'm getting the folowing error for below code, "1506-221 (S) Initializer must be a valid constant expression" FILE *fp[] = {stdout, dump_f}; is this acceptable? what is the proper way to achive this? ...

Is there a way for an AIR 1.5 app to read from stdin and write stdout/stderr?

Have been studying the file system related classes of Adobe AIR 1.5, but so far I've not seen anything that mentions how to interact with stdin/stdout/stderr. Is a bit surprising as AIR makes it possible to otherwise interact with the local file system, and there is a FileStream class. Am wanting to launch an AIR app from a parent proce...

Setting the correct encoding when piping stdout in python

When piping the output of a python program, the python interpreter gets confused about encoding and sets it to None. This means a program like this: # -*- coding: utf-8 -*- print "åäö" will work fine when run normally, but fail with: UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 0: ordinal not in range(...

python 3.0, how to make print() output unicode?

I'm working in WinXP 5.1.2600, writing a Python application involving Chinese pinyin, which has involved me in endless Unicode problems. Switching to Python 3.0 has solved many of them. But the print() function for console output is not Unicode-aware for some odd reason. Here's a teeny program. print('sys.stdout encoding is "' + sys.std...

C# console program - stop STDIN from going to STDOUT

I'm writing a simple console app in C#, .NET 2.0. It starts new threads using a threading timer, while it interprets commands on the main thread. I currently take three commands: P - Pause C - Continue Q - Quit This functionality works quite well, but unfortunately when I type P, C, or Q (or any other character for that matter), the c...

intercepting stdout of a subprocess while it is running

if this is my subprocess: import time, sys for i in range(200): sys.stdout.write( 'reading %i\n'%i ) time.sleep(.02) And this is the script controlling and modifying the output of the subprocess: import subprocess, time, sys print 'starting' proc = subprocess.Popen( 'c:/test_apps/testcr.py', shell=True, stdin=su...

C/C++ best way to send a number of bytes to stdout

Profiling my program and the function print is taking a lot of time to perform. How can I send "raw" byte output directly to stdout instead of using fwrite, and making it faster (need to send all 9bytes in the print() at the same time to the stdout) ? void print(){ unsigned char temp[9]; temp[0] = matrix[0][0]; temp[1] = ma...

How can I redirect STDERR to STDOUT, but ignore the original STDOUT?

I have a program whose STDERR output I want to inspect and run grep on etc. So I could redirect it to STDOUT and use grep, but the problem is, I do not want the original STDOUT content. So, this one won't do cmd 2>&1 | grep pattern because it will mix the original STDOUT and STDERR. And this one doesn't work since grep doesn't read...

How can I get the command-line output of a DOS tool using Perl?

Hi, I want to meassure the throughput of a link using Windows build-in FTP tool inside a Perl script. Therefore the script creates the following command script: open <ip> <username> <password> hash get 500k.txt quit Afterwards I run the command script using the following Perl code: system(@args); @args = ("ftp", "-s:c:\\ftp_dl.txt")...

How do I read the standard output from a child process in VB6?

When creating a process in VB6 (related to this question:), I'm using the following struct: Private Type STARTUPINFO cb As Long lpReserved As String lpDesktop As String lpTitle As String dwX As Long dwY As Long dwXSize As Long dwYSize As Long dwXCountChars As Long dwYCountChars...

How can I redirect stdout to some visible display in a Windows Application?

I have access to a third party library that does "good stuff." It issues status and progress messages to stdout. In a Console application I can see these messages just fine. In a Windows application they just go to the bit bucket. Is there a fairly simple way to redirect stdout and stderr to a text control or other visible place. Id...

Capture stdout in log4j/log4net

I have a library that writes to stdout in Java. I would like to capture this output in a log using log4j. (I didn't write this library, so I have no control over the code inside the library). Is there an easy way to do this? Is System.setOut the right approach? What do I pass to System.setOut? Also, how would you do this in .NET/C#...

`tee` command equivalent for *input* ?

The unix tee command splits the standard input to stdout AND a file. What I need is something that works the other way around, merging several inputs to one output - I need to concatenate the stdout of two (or more) commands. Not sure what the semantics of this app should be - let's suppose each argument is a complete command. Exampl...

Execute and Capture one program from another

In win32 programming in C: Whats the best way to execute a win32 console program within another win32 program, and have the program that started the execution capture the output? At the moment I made the program redirect output to a file, but I am sure I must be able to open some sort of pipe? ...

ABAP Stdout and Stderr

Does ABAP allow writing to stdout and stderr? I need to write small programs to test interface connections to SAP systems via a job scheduler(Cronacle). For instance, start/write 'Hello World!' + date + time to stdout/exit. I'm a .net programmer tasked with this seemingly TRIVIAL program and I'm stuck. ...

How to overwrite stdout in C

Not sure if this is phrased well or not... In most modern shells, you can hit the up and down arrows and it will put, at the prompt, previous commands that you have executed. My question is, how does this work?! It seems to me that the shell is somehow manipulating stdout to overwrite what it has already written? I notice that progra...

linux: redirect stdout after the process started

I have a process that already started, with stdout to the console. can I redirect it to a file, without restarting it? ...

Python's subprocess.Popen returns the same stdout even though it shouldn't

I'm having a very strange issue with Python's subprocess.Popen. I'm using it to call several times an external exe and keep the output in a list. Every time you call this external exe, it will return a different string. However, if I call it several times using Popen, it will always return the SAME string. =:-O It looks like Popen ...

Shell script to emulate warnings-as-errors?

Some compilers let you set warnings as errors, so that you'll never leave any compiler warnings behind, because if you do, the code won't build. This is a Good Thing. Unfortunately, some compilers don't have a flag for warnings-as-errors. I need to write a shell script or wrapper that provides the feature. Presumably it parses the com...

Capture standard output and still display it in the console window

I'm spawning a child process that runs in a visible console window (it's a batch file that runs MSBuild), and I'd like to have the output generated by the process displayed in the visible console window, as well as capture that output so I can process it in code. I've read several other questions and the MSDN documentation dealing with P...