From: Cody P S. <de...@co...> - 2015-04-23 21:43:24
|
On Thu, Apr 23, 2015 at 9:06 AM, Martin Ling <mar...@ea...> wrote: > On Thu, Apr 23, 2015 at 12:20:49PM +0100, D Haley wrote: >> >> Is there any way I can have the read function return when a delimiter is >> reached? I ran into this same thing recently when starting to write a program using libserialport. Do note that the lack of posix-like blocking behavior (ie: read at least 1 byte but up to N bytes) means one must either read one byte at a time or wire up the sp_event_set infra to do "read until X". The former is probably massively inefficient, and the latter takes quite a bit of code just to get efficiency (and has increased amounts of code, which leads to other efficiency and clarity concerns) Personally, I ended up just doing repeated single byte reads. |