[fpc-pascal] HOW TO, PROBLEM read stdin (linux) ??
Wanderlan Santos dos Anjos
wanderlan.anjos at gmail.com
Sat Nov 24 12:22:46 CET 2007
program yourprogram;
{$mode objfpc}{$H+}
uses
Classes, SysUtils;
var
st: text;
s: string;
begin
assign(st,'');
reset(st);
while not eof(st) do begin // <<<<<<<<--- iterate while not en of file
readln(st,s); //<<< read only a line
writeln(s);
end;
close(st); // <<<<<---
end.
--
Att,
Wanderlan Santos dos Anjos
On Nov 24, 2007 8:15 AM, TOUZEAU DAVID <david.touzeau at fr.kaspersky.com>
wrote:
> Dear
>
> What is the best way to read into a memory datas from this command.
>
>
> "/bin/myprogram </home/tests/file.txt "
>
>
> my test program read only the first line from stdline.
> What i miss ???
>
>
> program myprogram;
>
> {$mode objfpc}{$H+}
>
> uses
> Classes, SysUtils;
> var
> st: text;
> s: string;
> begin
> assign(st,'');
> reset(st);
> readln(st,s);
>
> writeln(s)
>
> end.
>
>
>
> --
> David Touzeau -------------------------- Linux Ubuntu 7.04 feisty
> FreePascal-Lazarus,perl,delphi,php artica for postfix management console
> (http://www.artica.fr) icq:160018849
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20071124/f6e9b5f4/attachment.html>
More information about the fpc-pascal
mailing list