> It is interesting to note that even this code reads input only after Enter is > pressed. Sounds logical. Stdin from console supports line editing (BackSpace, arrows, F3, F1, ...). This can only be accomplished by buffering complete lines.
Ludo -----Message d'origine----- De : fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] De la part de Anton Shepelev Envoyé : lundi 9 mai 2011 13:05 À : FPC-Pascal users discussions Objet : Re: RE : RE : RE : RE : [fpc-pascal] Redirecting input to a childprocess Ludo Brands: > If you need these handles from the child process use: > InHnd:=GetStdHandle(STD_INPUT_HANDLE); > OutHnd:=GetStdHandle(STD_OUTPUT_HANDLE); > ErrHnd:=GetStdHandle(STD_ERROR_HANDLE); Thank you, that's what I need. By the way, it does work in a simple single-process applica- tion: Program Test; uses Windows; var hIn: LongWord; buf: ShortString; bytesRead: LongWord; begin hIn := GetStdHandle(STD_INPUT_HANDLE); while(true) do begin ReadFile(hIn, buf[1], 5, bytesRead, nil); buf[0] := Chr(bytesRead); write(buf); end; end. It is interesting to note that even this code reads input only after Enter is pressed. Anton _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal