stdout

VBScript - Capturing output from stdout

风流意气都作罢 提交于 2019-12-07 16:38:10
问题 I know this has been answered one in another question, but I simply do not understand how it is done. I am trying to get the output of a command line program (Aria2 downloader) into a HTA script so it can be parsed and the download percentage, file size etc can be obtained and updated into a DIV dynamically. Here is the code I have adjusted and have been trying to use but it just locks up the interface until the command line has finished and THEN displays all the output, instead of displaying

Fastest way to print a certain number of characters to stdout in C

瘦欲@ 提交于 2019-12-07 12:02:55
问题 I have to print a certain number of blank spaces to stdout, but this number is not fixed. I'm using putchar(), but I'm not sure if this is fast. What is the fastest way to print a certain number of characters to stdout in C? Also, I cannot use system functions. Thanks for you help! 回答1: I would just use fwrite . Simple. Correct. Easy. void put_spaces(int n) { static const char SPACES[32] = " "; for (; n >= 32; n -= 32) fwrite(SPACES, 32, 1, stdout); if (n) fwrite(SPACES, n, 1, stdout); } Note

python popen.stdout.readline() hangs

不打扰是莪最后的温柔 提交于 2019-12-07 10:12:22
问题 Im having a problem... does anyone knows why this code hangs in the while loop. The loop doesn't seem to catch the last line of the stdout. working_file = subprocess.Popen(["/pyRoot/iAmACrashyProgram"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) line = working_file.stdout.readline() working_file.stdout.flush() while working_file != "" : print(line) line = working_file.stdout.readline() working_file.stdout.flush() the script hangs with the curser just blinking when

Is it possible to get the output of a program while it's running?

三世轮回 提交于 2019-12-07 09:18:24
问题 If I have a windows console program written with c++, is it possible to retrieve that program's standard output, while the program is running? And if not, what would be the best way to rewrite the program? I know I could output to files and continuously check those files for updates. Is there another way? Is there a better way? 回答1: There are some interesting articles in Code Project: CommandLineHelper (C#) Redirecting an arbitrary Console's Input/Output (MFC/C++) Universal Console Redirector

How to redirect C-level streams in Python in Windows?

旧时模样 提交于 2019-12-07 06:49:21
问题 Eli Bendersky has explained thoroughly how to "Redirecting all kinds of stdout in Python", and specifically Redirecting C-level streams, e.g. stdout of a shared library (dll). However, the example is in Linux and does not work in windows, mainly due to the following lines: libc = ctypes.CDLL(None) c_stdout = ctypes.c_void_p.in_dll(libc = ctypes.CDLL(None), 'stdout') How can we make it work in Windows? 回答1: I found the answer buried in Drekin's code. Based on that, I made a small change to Eli

Delphi - Capture stdout and stderr output from statically linked MSVC++ compiled DLL

落爺英雄遲暮 提交于 2019-12-07 05:18:57
问题 I have been trying to capture stdout and stderr output from a DLL compiled in MSVC++ that my Delphi app statically links to, but so far have been unsuccessful. procedure Test; var fs: TFileStream; begin fs := TFileStream.Create('C:\temp\output.log', fmCreate or fmShareDenyWrite); SetStdHandle(STD_OUTPUT_HANDLE, fs.Handle); SetStdHandle(STD_ERROR_HANDLE, fs.Handle); dllFunc(0); // Writes to stdout in MSVC++ console app, but not here // fs.Length is always zero fs.Free; end; Thought I was on

Node.js's python child script outputting on finish, not real time

老子叫甜甜 提交于 2019-12-07 04:51:15
问题 I am new to node.js and socket.io and I am trying to write a small server that will update a webpage based on python output. Eventually this will be used for a temperature sensor so for now I have a dummy script which prints temperature values every few seconds: Thermostat.py import random, time for x in range(10): print(str(random.randint(23,28))+" C") time.sleep(random.uniform(0.4,5)) Here's a cut down version of the server: Index.js var sys = require('sys'), spawn = require('child_process'

How to write utf8 to standard output in a way that works with python2 and python3

心已入冬 提交于 2019-12-06 22:37:25
问题 I want to write a non-ascii character, lets say → to standard output. The tricky part seems to be that some of the data that I want to concatenate to that string is read from json. Consider the follwing simple json document: {"foo":"bar"} I include this because if I just want to print → then it seems enough to simply write: print("→") and it will do the right thing in python2 and python3. So I want to print the value of foo together with my non-ascii character → . The only way I found to do

How to print to stdout from Python script with .pyw extension?

痞子三分冷 提交于 2019-12-06 21:52:26
问题 I have a python program with a wxpython GUI and some command line parameters. I generate a single windows executable with py2exe. I don't want to have a command line window in the background, so py2exe is making this a pythonw executable without this window. This is equivalent to use the *.pyw extension. The problem is, if you want to see the available command line arguments, you naturally do "main.exe -h" on a shell. Even though argparse is providing this information, it doesn't reach stdout

Tracing stdout and stderr in Tcl

放肆的年华 提交于 2019-12-06 20:54:29
I'm not sure if this absurd. Isn't it possible to trace the read and write of stdout and stderr in Tcl? I have tried the below and found no clue. % proc tracer {varname args} { upvar #0 $varname var puts "$varname value : $var" } % trace add variable stdout read tracer % trace add variable stdout write tracer % puts stdout hai hai % puts hai hai % trace add variable stderr write tracer % trace add variable stderr read tracer % puts hai hai % puts stderr hai hai As per the man page of puts , if no channelId is specified for puts command, then it defaults to stdout which means even with puts hai