[fpc-pascal] Pipe buffering, accessing C-style stdin/stdout
Marco van de Voort
marcov at stack.nl
Sun Apr 1 22:06:39 CEST 2007
> After a lot of googling and experimenting, I think I have managed to
> make it work, but only in C code, and I want it to run in Pascal. The
> key to make it work in C was to call setvbuf at the right time, to set
> the buffering mode for stdin/stdout. The problem with FPC is that I
> can't find any straightforward way to either get PFile-style
> stdin/stdout from the Text-style input/output (surely there is a
> connection?)
Yes. PFile _IS_ Text style. PFile is the C wrapper implementing buffer,
Text the analogue Pascal buffering. I assume that settextbuf to 0 didn't work?
( http://www.freepascal.org/docs-html/rtl/system/settextbuf.html )
If that doesn't work, you need to go back to the raw unbuffered IO, do a
IOCTL if necessary. FPOpen, FPClose, FPWrite, FPRead
Moreover, how does lazarus deal with this?
More information about the fpc-pascal
mailing list