Compiler Directive
Determines the application type : GUI or Console
{$AppType GUI}
2 {$AppType CONSOLE}
The $AppType compiler directive sets the application type. The default is for Graphical applications.
When you create a Console application in Delphi, it automatically inserts a {$AppType CONSOLE} statement near the start, with no forms or other such clutter.
A console application allows you to write/read to/from the console Input and Output files using Read, ReadLn, Write and WriteLn statements without the need to perform AssignFile, Reset or ReWrite operations. Nor do you have to specify the file names - as show in the example code.
A GUI application does not need an $AppType statement - GUI is the default.
Related commands
ReadLnRead a complete line of data from a text file
WriteLnWrite a complete line of data to a text file
 Download this web site as a Windows program.

Example code : A simple console application
program Project1;

{$AppType CONSOLE}


  name : string;

  WriteLn('Please enter your name');
  WriteLn('Your name is '+name);
  WriteLn('Press enter to exit');
  Example console output :
  Please enter your name
  Joe Bloggs
  Your name is Joe Bloggs
  Press enter to exit
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page