[fpc-pascal]SelectText problem for stdin (Linux unit)
Anton Tichawa
anton.tichawa at chello.at
Tue Jul 23 21:09:34 CEST 2002
hello,
you can use 'select', look at the man page.
hth,
Anton Tichawa
On Tuesday 23 July 2002 15:36, you wrote:
> I'm traing to test if there is some input
> bytes ready in stdin. When i try this with normal
> file, all is ok - SelectText function from Linux unit
> give me n>0 if any character is ready.
>
> When i try with file 'input', SelectText give me 0
> until 2 lines are entered. How to go round this
> without using old and more low-level libs like crt ?
>
> ------- test program -------
>
> program test;
> uses Linux;
>
> var n:longint; w:char; TV:TimeVal;
>
> begin
> TV.sec:=0; TV.usec:=0;
> repeat
> n:=SelectText(input, at TV);
> if n>0 then begin
> read(w); write(w);
> write('[',n,']');
> end;
> until eof(input);
> end.
>
> --------- test results: ----------
>
> 1234
> abcd
> 1[1]2[1]3[1]4[1]
> [1]ABCD
> a[1]b[1]c[1]d[1]
> [1]
>
> --------- must be: ---------------
>
> 1234
> 1[1]2[1]3[1]4[1]
> [1]abcd
> a[1]b[1]c[1]d[1]
> [1]ABCD
>
> ----------------------------------
>
> =====
> Skelet
> ====== http://skelet.hit.bg
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list