What is a Delphi Console Application?While originally Delphi was developed for writing Windows applications with a "Graphical User Interface" (GUI), you can also use it for Console Applications. Worldwide, teachers use these pure text programs for teaching Pascal. Hey, back to the pre-historic DOS days! When you start a console application, Windows creates a text-mode console window through which the user can interact with the application. Note that a console program is not a DOS program, because it can call Windows functions. Setting up a simple console applicationThe main source code for a console application is contained in a textfile with a .DPR extension, a Delphi Project file. If desired, you can add additional source code units, .PAS files, but for simple programs this is not necessary. Console applications don't use the visual controls of Delphi's Visual Controls Library (VCL). So, since there are no "forms", there are no .DFM files.
In Delphi Community Edition, it's very easy to set up a new console application: 1. Select File
/ New / Other... This opens the New Items dialog window. 2. Select Console Application and click OK. In the code editor, you now see a program template: program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; begin try { TOTO -oUser -cConsole Main : Insert code here } except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. A simple example
» Part 2: Structure of the program; Input
and Output |
|
© Copyright 1999-2019
Studiebureau Festraets