I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution.
The workaround I use while I don't find a cleaner approach...
I'm trying to write a console (as in terminal, not gaming console) pong game in python and I'm having trouble figuring how best to (re)draw the game.
I was thinking of having an 2d array as a sort of bitmap, editing the array to reflect the ball/paddles new positions and then casting each row to a string and printing it. However that me...
Is output buffering enabled by default in Python's interpreter for sys.stdout ?
If the answer is positive, what are all the ways to disable it ?
Suggestions so far:
Use the -u command line switch
Wrap sys.stdout in an object that flushes after every write
Set PYTHONUNBUFFERED env var
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', ...
Is it possible to run an external process from Perl, capture its stderr, stdout AND the process exit code?
I seem to be able to do combinations of these, e.g. use backticks to get stdout, IPC::Open3 to capture outputs, and system() to get exit codes.
How do you capture stderr, stdout, and the exit code all at once?
...
I'm trying to start an external application through system() - for example system("ls") - i would like to capture it's output as it happens so i can send it to another function for further processing. What's the best way to do that in C/C++ ?
...
I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?
Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need to create my own lo...
I'm currently the Teaching Assistant for an Introduction to C class. The class is being taught using Visual Studio, but when grading I just use a simple Windows batch script to process all the assignment submissions, compile them, run them on a test file, and redirect the output to a series of text files I can print out, mark up, and han...
Ok, I am trying to use Tail to monitor a log file, but I cannot get the same behavior programatically as when I manually run it through cmd prompt using the same parameters.
When run through cmd prompt it displays the new lines instantly. Programatically though, I have to wait for about 75+ new lines in log file before the 'buffer' unle...
i need to redirect all of the stdout of a program except the first line into a file.
Is there a common unix program that removes lines from stdin and spits the rest out to stdout?
...
I have some scripts that ought to have stopped running but hang around for ever.
Is there some way I can figure out what they're writing to stdout and stderr in a readable way ?
I tried, for example, to do
tail -f /proc/(pid)/fd/1
but that doesn't really work. It was a long shot anyway.
Any other ideas ? strace on its own is quite...
Anyone know where to find a reference that describes how to output color on the Windows CLI interfaces using API and/or stdout?
...
I want to write a small program that should print something like
testing CPU... done
testing RAM... done
and so on.
I wrote the following program in C:
printf( "testing RAM...\t\t" );
sleep( sleep_time );
printf( "done\n\n" );
printf( "testing HDD...\t\t" );
sleep( sleep_time );
printf( "done\n\n" );
where sleep_time i...
I am invoking a C library via JNI that prints to stdout. How can I redirect this output to System.out?
...
How do I launch an app and capture the output via stdout and maybe stderr?
I am writing an automated build system and I need to capture the output to analyze. I'd like to update the svn repo and grab the revision number so I can move the files in autobuild/revNumber/ if successful. I also would like to build using make and upload the co...
I'm using the following code
System::Diagnostics::Process^ p = gcnew System::Diagnostics::Process();
p->StartInfo->FileName = "tnccmd.exe";
p->StartInfo->UseShellExecute = false;
p->StartInfo->RedirectStandardInput = true;
p->StartInfo->RedirectStandardOutput = true;
p->Start();
System::IO::StreamWriter^ tnc_stdin = p->StandardInput;
...
Given an instance x of Callable<T>, how can I run x in a separate process such that I can redirect the standard input and output of the process? For example, is there a way to build a Process from a Callable? Is there a standard Executor that gives control over input and output?
[UPDATE] It's not important that the Callable execute in a...
I have a simple C++ program that reads stdin using scanf and returns results to stdout using printf:
#include <iostream>
using namespace std;
int main()
{
int n, x;
int f=0, s=0, t=0;
scanf("%d", scanf("%d",
for(int index=0; index<n; index++)
{
scanf("%d",
scanf("%d",
scanf("%d",
...
Hello all,
I'm having a very peculiar problem in my Python FastCGI code - sys.stdout has a file descriptor of '-1', so I can't write to it.
I'm checking this at the first line of my program, so I know it's not any of my code changing it.
I've tried sys.stdout = os.fdopen(1, 'w'), but anything written there won't get to my browser.
The...
I have a Windows C++ program that is doing something like:
FILE* pf = ...;
*stdout = *pf; // stdout is defined in stdio.h
I'm looking for an explanation about what happens when you change the value of the stdout file handle. Is this just a way of redirecting stdout?
-cr
...
Are there any conventions for formatting console output from a command line app for readability and consistency? For instance, do you indent sub-information, when do you print a blank line, if ever, how should you accent important statements.
I've found output can quickly degenerate into a chaotic blur. I'm interested in hearing abou...