• 0

How to capture the output of a console app in BCB


Question

Hi,

I want to be able to launch and capture the output produced by a console application

such as a compiler or whatever it is ran from my program in BCB. Is this hard to do?

Can't I just ShellExecute the executable and then redirect the output to a temporary text file and then just read the text file? If yes, I know in Unix, if I want to re-direct the output you would use the < redirection symbol for example "ls -l < output.txt" What is the symbol for DOS to redirect the output to a text file?

I can achive this via code and then just read the file.

By the way, I am not a Unix/Linux guy, I just know this from Uni...and reading Unix books.

Anyway I have searched the Borland Developer Network but all the samples I found there are written for Delphi (something which I don't have or know too well) and JBuilder too but I was unable to find examples for C++ Builder, the tool that I use.

May someone please show me or hint me how to achieve this? I know I have been asking a lot and you have been of great help so I thank you all for that and so that you know, I do have a book but many specific things like this are not documented.

4 answers to this question

Recommended Posts

  • 0

I think I might have found a solution :) WOW, this is more complicated then what I thought

Check this out!

http://bdn.borland.com/article/0,1410,10387,00.html

UPDADATE: Ok, that's not what I expected. The author there doesn't use VCL, instead, pure command line, back to square one.

Edited by ford_fpv
  • 0

UPDATE 2GUI app can display the errors to the

user, such as in a TMemo or popup MessageBox. Use the hStdOut and hStdError

members of the STARTUPINFO structure for that when calling CreateProcess().

Use CreatePipe() to create an anonymous pipe that you can then pass to

ReadFile();

Getting closer but not close enough

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Half the problem was that they had the damn MSN team as part of Windows for some dumb reason. Now that's finally been changed and we're seeing the effects with you finally being able to turn off the recommended section in the start menu.
    • It hasn't been a decade? Not really. The Settings app in 11 isn't the same as the one in 10. Sure the name is the same but they, probably, redid it all over again, not just changed the top UI layer. I think the old one in Win10 is coded in a way that made it a chore to move more complicated things over. Since the change to the one in Win11, they've actually started move things over and adding things a bit quicker. The fact is that some of the more advanced settings/options are low on the list because few users bother with them compared to the basic ones everyone will go through at some point, like changing the background for example.
    • Free Download Manager 6.28.1.6321 by Razvan Serea Free Download Manager is a powerful, easy-to-use and absolutely free download accelerator and manager. FDM accelerates downloads by splitting files into sections and then downloading them simultaneously. As a result download speed increases up to 600%, or even more! FDM can also resume broken downloads so you needn`t start downloading from the beginning after casual interruption. FDM lets you download files and whole web sites from any remote server via HTTP, HTTPS and FTP. You can also download files using BitTorrent protocol. In addition, Free Download Manager allows you to: adjust traffic usage; to organize and schedule downloads; download video from video sites; download whole web sites with HTML Spider; operate the program remotely, via the internet, and more! Free Download Manager is compatible with the most popular browsers Google Chrome, Firefox, Microsoft Edge, Internet Explorer and Safari. Free Download Manager 6.28.1.6321 changelog: Improved add-ons support. Improved M3U support. Fixed: crash bug in BitTorrent module. Fixed: minor bugs. Windows: a bit improved installer. Windows: Firefox bug workaround. Android: Qt updated to 6.9.1. Download: Free Download Manager (64-bit) | 45.8 MB (Freeware) Links: Home Page | Linux, Mac, Android | MS Store | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Tariffs have nothing to do with this pricing. It was always intended to be slightly more expensive then the S25+
    • Hello, The static link still downloads 10.3.2040.0 from May 22, 2025. The 10.3.2412.0 version can be downloaded directly from emclient.com/dist/v10.3.2412/setup.msi. Regards, Aryeh Goretsky
  • Recent Achievements

    • Contributor
      GravityDead went up a rank
      Contributor
    • Week One Done
      BlakeBringer earned a badge
      Week One Done
    • Week One Done
      Helen Shafer earned a badge
      Week One Done
    • First Post
      emptyother earned a badge
      First Post
    • Week One Done
      Crunchy6 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      662
    2. 2
      ATLien_0
      269
    3. 3
      Michael Scrip
      236
    4. 4
      Steven P.
      164
    5. 5
      +FloatingFatMan
      149
  • Tell a friend

    Love Neowin? Tell a friend!