Write your Own "IDE"--how to capture the standard output of a console program in real time in a graphical interface.
The IDE is the abbreviation for the Integrated development environment (integrated Development environment). There are a lot of good Ides, like JBuilder and Kylix, like Visual Studio. I do not know whether you have noticed that most of the IDE itself only provides code editing, engineering management, such as human-computer interaction functions, when we compile code in the IDE, debug the program, the IDE needs to invoke the command line compiler, the debugger to complete the appropriate action. For example, when you compile a C + + program using Visual Studio, we see the entire process of compiling and connecting in the Output window below the IDE, although we don't see the pop-up dos window, but actually the IDE starts Microsoft C + + Compiler cl.exe and connectors link.exe both command-line programs, while Cl.exe and link.exe outputs are reflected in the IDE's output window in real time. Also, we can configure the tools we need (such as special compilers) in Visual Studio, and then let Visual Studio run the tools at the right time and display the output of the utility program to the Output window in real time. The following figure is a scenario where I run J2SDK in Visual Studio 6.0 's Output window to compile the Java source program and display a syntax error in the program: Javac.exe
That is, most IDE tools can invoke specific command-line programs in the integrated environment (more specifically the console program in WIN32), and then capture their output in real time (which is mostly output to the standard stdout and stderr streams), and displays the captured information in the graphical interface window.
This is clearly a potentially valuable feature. Using this technology, we can at least
1. Write your own IDE, if we have enough patience;
2. Embed Full-text search functionality in our own applications (invoke the Grep.exe tool in Borland C + +), or compress and decompress (the compression decompression program that invokes the console mode, such as Arj.exe, Pkzip.exe, etc.);