468,513 Members | 1,881 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

c++ data pipe

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 pipe\n";
close(OSA);

can someone show me the equivilent in c++?
thanks

Sep 9 '06 #1
2 3246
David wrote:
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 pipe\n";
close(OSA);

can someone show me the equivilent in c++?
thanks
You can do one of the following:
1. Redirect the standard output to some file or other file interface
using
stream = freopen( "freopen.out", "w", stdout );
(you can replace stdout with stderr to redirect standard error)

2. Use Interprocess Communication Mechanism. If you use unix I can't
help you there. You should search for it.

3. Btw, you can simply use pipe. Use the command to redirect the
standard output...

Sep 9 '06 #2
In article <11**********************@h48g2000cwc.googlegroups .com>,
wi**************@gmail.com says...
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 pipe\n";
close(OSA);

can someone show me the equivilent in c++?
Not really -- c++, per se, doesn't provide an equivalent. Assuming
you're using something at least vaguely similar to UNIX, if you ask
about popen() in a newsgroup devoted to development for that OS, they'll
be able to help you out.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Sep 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by richard | last post: by
13 posts views Thread by j. del | last post: by
2 posts views Thread by razorfold | last post: by
2 posts views Thread by Tenacious | last post: by
1 post views Thread by mark.heyden | last post: by
5 posts views Thread by Chris Hieronymus | last post: by
1 post views Thread by Henning Friese | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.