473,395 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

About pipe stdio and redirect

In msdn library, there is an example about "Creating a Child Process with
Redirected Input and Output".
now in my case, the child process whill use "printf" to write to its
stdout which is redirected to my pipe. but as you know, the "printf" is
buffered, so the problem is that the parent's "FeadFile" can not return when
the child has already use "printf" to write something. (!!!Note that the
child process is a third party application,I can't modify it, and the child
and parent are interactive, I must know what child had written in each step,
and I can't close the handle).
How can I solve this problem? Thank you very much.
Nov 17 '05 #1
1 1524
binaryboy wrote:
In msdn library, there is an example about "Creating a Child Process with
Redirected Input and Output".
now in my case, the child process whill use "printf" to write to its
stdout which is redirected to my pipe. but as you know, the "printf" is
buffered, so the problem is that the parent's "FeadFile" can not return when
the child has already use "printf" to write something. (!!!Note that the
child process is a third party application,I can't modify it, and the child
and parent are interactive, I must know what child had written in each step,
and I can't close the handle).
How can I solve this problem? Thank you very much.


Unless you can tell the child process to unbuffer stdout or flush after
every write, there's nothing you can do. I don't know of any hidden way to
get a VC program to do these things.

--
Doug Harrison
Microsoft MVP - Visual C++
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MK | last post by:
I have a Win32 console application (SNMPUTIL.EXE) which listens to incoming SNMP messages: C:\>snmputil trap snmputil: listening for traps... When a trap is generated on a remote server, it...
2
by: Hoegje | last post by:
I am writing a C++ program, which should create a sub- process to start a telnet session to another server. Then it should login to that server (on the telnet login) and execute one or more...
5
by: richard | last post by:
I have a simple test to pass information from a client to a server using named pipe. what I really want is: when I type a line on the client, the server will output the line immediately. but to my...
10
by: seema_coma | last post by:
Iam working on Client, Server programming on Linux in C++. I have a Server Daemon running in the background, my client program talks to the Server and extracts some data which I am printing on the...
6
by: Carson | last post by:
Hi, How to write c code such that it supports pipe in? i.e., echo "ABCD" | a.out (how to write a c-code which generates the binaries a.out that can take the pipe in input for further...
7
by: Greg | last post by:
I am trying to implement the UNIX pipe command using C but with the "->" operator. Everything works fine with 1 pipe, but when I try to use 2 or more, it hangs up when reading the pipe_in...
4
by: bill | last post by:
I am confused by the behavior of the following code. The function copy() takes two FILE *'s and copies the data from one to the other. In the main routine, I create a pipe and copy stdin to the...
2
by: David | last post by:
im trying to figure out how to pipe data to an application with c++ Here is how I would do it in perl open(OSA, "| /usr/bin/osascript") || die "Can't pipe to osascript"; print OSA "some text to...
2
by: Igna | last post by:
Hello. I have to write a pipe to joint a GUI in perl and a simulation program in c. I have read all the docs found in perl.com and now I am trying to make a test with this simple program if it is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.