Create a new project. Create a new project from File->New->Others. Select Delphi Projects in the Item Categories list. On the right side, you will see a Console Application item. Select it and click the OK button to create your project.
Notice the code skeleton created. Delphi IDE will create a code skeleton as follows:
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{ TODO -oUser -cConsole Main : Insert code here }
end.
Define your code. What you need to do is define your code between begin and end. For example, to output text to standard console, you will want to use the WriteLn() function.
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
WriteLn('Hello there. This is my first console mode application');
end.
Save your project. For example, save your project as Hello. To test your application in Delphi IDE, press F9. Delphi automatically builds your project if your application has not been built. You may not read the text outputted on the console because it shows and closes windows quite fast. You can run your application from the command prompt. Go to Start->Run. Type cmd and press the Enter button or click OK. Change the current directory to your project directory, then type Hello and press Enter.




Delicious
Digg
Google
Yahoo