[fpc-pascal] Pipe buffering, accessing C-style stdin/stdout
Vincent Snijders
vsnijders at quicknet.nl
Sun Apr 1 22:07:18 CEST 2007
Marco van de Voort schreef:
>> 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?
I guess Lazarus doesn't care, as long as it gets all the information at
the end. There is no bidirectional communication between Lazarus and the
compiler.
Vincent
More information about the fpc-pascal
mailing list