Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DELPHI 2.0 - How to read the "standard input"...

66 views
Skip to first unread message

Bengt-Roger Elstad

unread,
Apr 21, 1996, 3:00:00 AM4/21/96
to
Anybody know how to read the standard input in
Delphi 2.0? ({$APPTYPE CONCOLE} is in place...)

I've tried readln and read, but it doesn't seem to
work. A little sample program will be apreciated!!!

TIA
Bengt

Tommy Ovesen

unread,
Apr 24, 1996, 3:00:00 AM4/24/96
to Bengt-Roger Elstad

Here's a little sample from Turbo-Pascal, but I'm sure it will
work in console mode Delphi apps.

var stinfile:Text;

begin
assign(stinfile,''); {assign standard in with a filehandler}
reset(stinfile);
read(stinfile,c); {reads one char from stdin}
close(stinfile);
end.

--
Tommy Ovesen
Norwegian Institute of Fisheries and Aquaculture.

Paul Stohr

unread,
Apr 29, 1996, 3:00:00 AM4/29/96
to

Bengt-Roger Elstad <b...@axp1.pmddata.no> wrote:

>Anybody know how to read the standard input in
>Delphi 2.0? ({$APPTYPE CONCOLE} is in place...)
>
>I've tried readln and read, but it doesn't seem to
>work. A little sample program will be apreciated!!!
>

>TIA
>Bengt

Yep. It's actually pretty easy to do but you need to use the API. I
wrote a CGI interface to get STDIN get CGI values for variables and
URL Decode them, Get enviroment variables and write to STDOUT.
Actually it was the first Delphi 2.0 program I ever wrote (converted
my VB 4.0 version of it). Email me and I'll get you started, at this
point I wish to clean up my code a little before I post it on the web.

Paul Stohr
pst...@prplus.com

Paul Motyer

unread,
May 2, 1996, 3:00:00 AM5/2/96
to

Bengt-Roger Elstad <b...@axp1.pmddata.no> writes:
> Anybody know how to read the standard input in
> Delphi 2.0? ({$APPTYPE CONCOLE} is in place...)
>
> I've tried readln and read, but it doesn't seem to
> work. A little sample program will be apreciated!!!
>
> TIA
> Bengt

use:

function ReadAChar:char;
var a:char
begin
read(input,a);
result:=a;
end;

HTH,

Paul, (Thurs, 2 May 96, 10:59 EST)
SoftStuff, Croydon, Victoria, Australia, 3136
pa...@linuxserver.pccity.com.au

0 new messages