www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Output from program run via "system()"

reply John Demme <me teqdruid.com> writes:
Hey guys,

        I'm a Linux guy, but I was recently asked to do a small app in Windows. 
I'm hoping if won't be so bad since I'm going to use D and Mango.

        One of the things this app needs to do is run an exe and grab it's
standard
output.  So, what's the easiest way to do this in Windows (and D)?

Thanks,
        John Demme
Feb 16 2006
parent reply "Regan Heath" <regan netwin.co.nz> writes:
------------OsV1aqE4ppA7krqDmXX2QR
Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15
Content-Transfer-Encoding: 8bit

On Thu, 16 Feb 2006 17:36:59 -0500, John Demme <me teqdruid.com> wrote:
 Hey guys,

         I'm a Linux guy, but I was recently asked to do a small app in  
 Windows.
 I'm hoping if won't be so bad since I'm going to use D and Mango.

         One of the things this app needs to do is run an exe and grab  
 it's standard
 output.  So, what's the easiest way to do this in Windows (and D)?

You could try this. Regan ------------OsV1aqE4ppA7krqDmXX2QR Content-Disposition: attachment; filename=process.zip Content-Type: application/zip; name=process.zip Content-Transfer-Encoding: Base64 UEsDBBQAAAAIACgHlTJR1iUbfAwAAHwqAAAJAAAAcHJvY2Vzcy5k7Rppb+JI9jOR 8h9qGO2OSVhCoozUGjY7osHpoKYh4mimt3uEHFxAKcb22uUc05v+7fteHXb5IJ2Z Hmml1aJuA/Xuo957VeTk6PCAHJFeED5GbLPlxFo1yFm7/aNYntCN45Mr6vAtfhdr 1zTasThmgU94QJKYNskKqJtkF7hsDe8ui3nEbhJOieO7JKaeR/iWxSQO1vzeiahg gyDGY+IGq2RHfe5w5LgOIoA8kjCJwiCmBKi2NKI3j2QTOT6nLrlnfBsknKwpbQpG YRTcMRcgfOtweIDUm+COCqWkSX7A2QqWw5A6EWE+cUAjADMaoxqCiyC+CfhWfioT +640IszMz/EVXIB3nIRhEHHmb/KmtQjpJqB6RHbOLQj2AxLRMKKxRohR74QrbSgw Yty5YR7jjyRY5z1Y9FOLDDj6SvtCMKk7MazVU4/RBxQ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2oqX/TODNpjB9fa2qPRiz TOTZVs/iZRCFglu3Eahsvr+jn0fzP1IO14fpeghTdT5Cl0pfSi86FeZWu3EbvtQW qgkqDdvTIfCcTEFsOglloI/z2NntsD866zXY4VaULdyyhGpCn0S8jqrO5CvITgXE euTgC4nQfSV1hbyROAjwA9Sjl2TnSfID5BG74kxVRiBB3DnlYPGRcrtYnq19yGci 8Nl+q1agm2riJbM8T5VnShsvG7PVwm8U0iyBWj1lDxxqTsj4PdR8pQt+EP27hqUs ksVHOrA/H35tQI9/eTO6PRuc9y8uczP89YxnHhtsUaZSWMNiQUuy/bUBG4re4OKV HDQRZGArbWxDr0wKMTrlcYPcMVsOtH7KpfZAJvzWDByEFqLvmbU9KatBuoJaDH9b hYYCL6yQEwH6zmx7IjNNRJPR4VA0I1aN1KkxZ7l5y6VAHvnknjtIFR2Dvw1qYskV Ii0+edHZOsIP1CcoZq4XRhcEGenxO5uDMjKiT9unTyz2Ejx+jKZQTUWQFXGHPayT bzh08QBfaARj++WPRmrPrLJ7WuPyqsdxTBHA63OxVFe35/QtTaXMJMYP5YWsTGPP 3YkgQACI9MGHUf/6j628jVilz1irTRW2F4fttu6ptPq0f/eEBHbEkja9ny4uoUH+ 8O9PNxej6+5pv1fa2m11Sq5I1pcQY4zdMZj1Ts9kacB57Pzahn9m92M0WLXXUI4p 7QzUkN3u2024+hb2md6RH0Bg/AdQSwECFAAUAAAACAAoB5UyUdYlG3wMAAB8KgAA CQAAAAAAAAABACAAAAAAAAAAcHJvY2Vzcy5kUEsBAhQAFAAAAAgAeAaVMkaGSf/H DAAAczIAAAwAAAAAAAAAAQAgAAAAowwAAHBpcGVzdHJlYW0uZFBLBQYAAAAAAgAC AHEAAACUGQAAAAA= ------------OsV1aqE4ppA7krqDmXX2QR--
Feb 16 2006
next sibling parent "Charles" <noone nowhere.com> writes:
Unfortunately this is ridiculously complex on win32.  Although Regan's class
looks pretty sweet .

Charlie


"Regan Heath" <regan netwin.co.nz> wrote in message
news:ops4297eh023k2f5 nrage.netwin.co.nz...
 On Thu, 16 Feb 2006 17:36:59 -0500, John Demme <me teqdruid.com> wrote:
 Hey guys,

         I'm a Linux guy, but I was recently asked to do a small app in
 Windows.
 I'm hoping if won't be so bad since I'm going to use D and Mango.

         One of the things this app needs to do is run an exe and grab
 it's standard
 output.  So, what's the easiest way to do this in Windows (and D)?

You could try this. Regan

Feb 17 2006
prev sibling parent John Demme <me teqdruid.com> writes:
Regan Heath wrote:

 On Thu, 16 Feb 2006 17:36:59 -0500, John Demme <me teqdruid.com> wrote:
 Hey guys,

         I'm a Linux guy, but I was recently asked to do a small app in
 Windows.
 I'm hoping if won't be so bad since I'm going to use D and Mango.

         One of the things this app needs to do is run an exe and grab
 it's standard
 output.  So, what's the easiest way to do this in Windows (and D)?

You could try this. Regan

Looks like it'll do the trick. Thanks, Regan. ~John Demme
Feb 17 2006