471,850 Members | 1,017 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 3430
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
NeoPa
reply views Thread by NeoPa | last post: by
aboka
reply views Thread by aboka | last post: by

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.