Jonas Maebe schrieb:
Holger Bruns wrote on Mon, 02 Nov 2009:

Martin schrieb:
you can do:
var buffer: Array of byte;

SetLength(Buffer, 1000);
SerRead(Handle, Buffer[0], 1000);

I checked this out. It works not reliable. Sometimes I get real data, sometimes the data are corrupted. I have no idea to rule out corrupted data.

You have to check the result of the serread routine. Since it returns the result of the fpread call, "man 2 read" will tell you what those results mean. In short, a) result >= 0: actual number of bytes read (the 1000 you pass is just a maximum)
b) result < 0: an error occurred

Thank you. I checked this out, but every incoming character is interpreted as zero, regardless of its real value.

Holger

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to