[fpc-pascal] Access to RS232 ports with fpc

Holger Bruns holger.bruns at gmx.net
Sun Nov 1 22:07:12 CET 2009

J├╝rgen Hestermann schrieb:
>> function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): 
>> LongInt;
>>    begin
>>    Result := fpRead(Handle, Buffer, Count);
>>    end;
>> i don't understand the declaration for "buffer" in the function 
>> below, because no type is declared for "buffer". 
> I believe that the type is irrelevant, you can use whatever you want. 
> I think that it's just used by fpRead to buffer data. You only provide 
> the space for the buffer but you don't need to read it directly. It 
> seems that Count has to be the size of the buffer. But I am just 
> guessing....
My hope was to read more than guessing. As I pointed out, the "buffer" 
seems not to be filled with incoming data from the selected serial port. 
Hence I cannot read just this data, and serread seems to be faulty. For 
this reason I ask for an advice. I need to look on working sample code 
to use this function in a working manner. In my example, serread replies 
only, what has been written with serwrite right before. Not even 
serflush, executed right after serwrite, can solve this problem to me.


More information about the fpc-pascal mailing list