473,625 Members | 3,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pipes

Hi. I'm rtying to use pipes to communicate between a python GUI and a
spawned C++ program. I prefer not to use forking because the app may
be run on windows, where forking isn't supported. Roughly what I'm
doing is:

(r,w) = os.pipe()
spawnl(P_WAIT, 'tool.exe', ' ', message, str(w))
close(w)
print os.read(r, 1000)

In c++ ,
....
int main(int argc, char** argv)
{

}

Sep 11 '07 #1
1 1529
On Mon, 10 Sep 2007 20:15:40 -0700, yagyala <mb****@phys.ks u.edu>
wrote:
>Hi. I'm rtying to use pipes to communicate between a python GUI and a
spawned C++ program. I prefer not to use forking because the app may
be run on windows, where forking isn't supported. Roughly what I'm
doing is:

(r,w) = os.pipe()
spawnl(P_WAI T, 'tool.exe', ' ', message, str(w))
close(w)
print os.read(r, 1000)

In c++ ,
...
int main(int argc, char** argv)
{

}
The 'subprocess' module provides an easier interface imo, eg:

process = subprocess.Pope n('tool.exe', stdin=subproces s.PIPE,
stdout=subproce ss.PIPE, universal_newli nes=true)
(self.outstream , self.instream) = (process.stdout , process.stdin)

Daniel Klein
Sep 11 '07 #2

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

Similar topics

0
2285
by: Christian Hammers | last post by:
Hello I would like to call a unix shellscript from within a PHP script and - write data to its STDIN - read data from its STDOUT *and* STDERR - get its exit code afterwards proc_open seems to be the right thing to use but I have the problem that the called program gives >8kb data on both stdout/stderr back which causes my PHP script to simply hang in the fread call. To be precise the first 4096 "O" characters are read and displayed. ...
5
3218
by: Peng Yuan Fan | last post by:
Hi, sorry if you found I have multi posted in different groups. It didn't appear in that group. I am trying to write an automated testing program with CxxTest, which in turn needs to talk to gdb through the command line. The program should give some command to gdb, the debugger program. And then get the results out of it. Just like when we debug with gdb, we type in those commands, and see the results. But this has to be done in an...
5
18125
by: glenn.owens | last post by:
In the process of doing some routine monitoring/clean-up we've discovered that several (many?) users are apparently set to access our SQL Server 2000 database instances via the Named Pipes protocol. In readings and recommendations we've decided that our WAN would be best served if we use the less "chatty" TCP/IP. As such we've also decided to try to enforce this decision to use TCP/IP exclusively using the domain login script used by all...
2
2702
by: Rudolf Bargholz | last post by:
Hi, DB2 7.1 FP11 Windows 2000 Earlier this evening, after dropping and recreating a trigger, DB2 locked up. I am not entirely sure that the cause of the problem was the replacing of the trigger, but all of a sudden no users were able to connect to our customers database. After running db2dart I found numerous corrupted indexes which I removed using "db2dart MYDB /IM". Finally I was able to get a
9
2547
by: Hans J?rg Brinksmeyer | last post by:
Hi, does anyone have an idea for this problem: I use anonymous pipes to steer a console program under Win2000 with a second 'steering aplication'. The stdin and output are redirected to pipes. The console application has several fgets() and fgetc() to read strings and chars. This works very fine with the pipes.
4
7649
by: Ken Allen | last post by:
Is there any built-in facility for handling named pipes in C#/.Net, or must one use unsafe code to access the WIN32 API directly? There exists some code that uses named pipes heavily and there exists a need for that code to send some information to a new .Net service I am writing. It is a relatively simple matter for the existing code to use a named pipe to send the data, but I can find no references to how I can create the named pipe...
7
4199
by: webmaster | last post by:
Sorry if this sounds naive, but I need to know how to create a two-way pipe between my Objective-C MacOSX program and another process, like perl, for example. Is there a simple way to do this in C, or one in the Apple Foundation kit for Objective-C?
1
1670
by: Jarrod Morrison | last post by:
Hi All Im looking for a way use named pipes between a service app and an app run when a user logs on and be able to pass string based data, im hoping that the service can contact the app that is running in the user session and tell it a path of an app to launch as the logged on user. Does anybody know of an easy way to do this or have any examples i could look at ? Any help is greatly appreciated Many thanks
3
15978
by: ZhukovL | last post by:
I'm having some trouble implementing the handling of multiple pipes in a shell I'm writing. I was hoping someone could point me in the right direction because I really cant see where I'm going wrong. Its supposed to work as follows: main shell forks off a child shell, the child shell sets up the pipes and forks off n-1 other shells (where n is the total number of commands). Each child shell sets its pipe file descriptors then execs to...
7
7624
by: andrewb | last post by:
Hi all, Having some trouble using named pipes and Visual Basic .NET and would appreciate and help you could offer. Essentially I am trying to develop a simple client/server application that exchanges text messages using named pipes. The internet resources seem a bit scarce and the only Microsoft resource I can find is http://support.microsoft.com/kb/871044.
0
8259
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.