Console Application (for CGI)

Hi...

I want to develop a console application with Delphi, to use it as a CGI application. So I need to read/write from/to the standard in/output. How can I do this...?

Thanx
  Sven
sven99Asked:
Who is Participating?
 
BlackDeathConnect With a Mentor Commented:
you're welcome
0
 
BlackDeathCommented:
try
{$APPTYPE CONSOLE}
in your project source

regs,
Black Death
0
 
BlackDeathCommented:
example:

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

{$R *.RES}

var
  i: integer;
 
begin
  Write('enter value:');
  Readln(i);
  Writeln('you entered: ' + inttostr(i));
  Write('press ENTER to end the program');
  Readln;
end.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
sven99Author Commented:
Thank you very much... do you mark the question to answered, that I can give you the Points...

Bye
  Sven
0
 
viktornetCommented:
Hello you two!

I know this that's the way to do a console app, and I've tried many other ways, and some kinda components, but never got it working. here is similar to what I get....When I try to run the app I get "This program can not run without Microsoft Windows", or something similar. I can't exactly see what it says because it closes it immediately and the app runs in the background. When I open the task menager by pressing Ctrl+Alt+Del and close the app so it stops running, my computer hangs up and the on;ly way to get out of that is ti press the Reset button. Any ideas on why it is doing that? or maybe what settings I need to set so it can run on my computer too...

regards,
Viktor Ivanov
0
 
sven99Author Commented:
Hmmm, I have tried it, ad it works... You can give me your EMail adress, and I will sent you my Testproject, including the EXE-File.

I use Borland Delphi 3.0 and Windows NT.

Bye
  Sven
0
 
sven99Author Commented:
Thanx.


0
 
sven99Author Commented:
"victornet", you can reach me under sschaefer@interflex.de
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.