Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - C question | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
labmaster

Blue Octorok
Level: 12

Posts: 16/43
EXP: 6135
For next: 1786

Since: 07-17-04
From: New Zealand!

Since last post: 10 days
Last activity: 2 min.
Posted on 01-15-05 01:56 PM Link | Quote
Okay, here's the scenario. I have a program called A.exe. I want A.exe to be able to run B.exe (a command line program), and capture its output, storing it into a buffer. Is this possible with C/++, and if so, would I do it (I know it can be done with some scripting languages like perl).

Note: Names have been changed to protect their identity.
Euclid

Cheep-cheep
Level: 23

Posts: 129/193
EXP: 65528
For next: 2195

Since: 03-15-04
From: Australia

Since last post: 24 days
Last activity: 7 days
Posted on 01-16-05 04:10 AM Link | Quote
I remember being able to do that in unix... though i have no idea if the c function call "System("") is actually there in windows.

what I'll be doing is something like this:
System("b.exe > somefile");
then all the input you want is in somefile.

But if you want A.exe and B.exe to run together and depending on what happens in B, A will act differently, then you'll have to go into all those yucky semaphores and monitors. (and shared memory and stuff)
labmaster

Blue Octorok
Level: 12

Posts: 17/43
EXP: 6135
For next: 1786

Since: 07-17-04
From: New Zealand!

Since last post: 10 days
Last activity: 2 min.
Posted on 01-16-05 05:53 AM Link | Quote
Yeah, that's what I've got at the moment (slightly less pretty, it creates a temporary batch file and winexec's it), I was hoping there was a better way of doing it, but I can live with that.
Parasyte

Bullet Bill
Level: 35

Posts: 194/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 01-16-05 10:16 AM Link | Quote
This is probably what you want: http://www.codeproject.com/threads/redir.asp
labmaster

Blue Octorok
Level: 12

Posts: 18/43
EXP: 6135
For next: 1786

Since: 07-17-04
From: New Zealand!

Since last post: 10 days
Last activity: 2 min.
Posted on 01-17-05 10:36 AM Link | Quote
Awesome - thanks Para.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - C question | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.005 seconds.