Pages: [1]   Go Down
Author Topic: serial readbytes until  (Read 845 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Using readbytesuntil works fine but doesn't transfer the terminator to the buffer. I need to examine the contents of the buffer and often send it on by another serial port but I want it terminated by the same terminator. I can add this to the buffer easily enough but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on. The application reads data from a PC and sends it on to my amateur radio transmitter (TS2000X).  Neil, G3RIR
Logged

Offline Offline
Full Member
***
Karma: 4
Posts: 187
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Using readbytesuntil works fine but doesn't transfer the terminator to the buffer. I need to examine the contents of the buffer and often send it on by another serial port but I want it terminated by the same terminator. I can add this to the buffer easily enough but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on. The application reads data from a PC and sends it on to my amateur radio transmitter (TS2000X).  Neil, G3RIR

Posting a question is also an Art smiley-cool. First describe you TASK, Post your CODE, and then where you STUCK.
Logged

From Idea To Invention

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Using readbytesuntil works fine but doesn't transfer the terminator to the buffer.
Of course not. That's by design.

Quote
I can add this to the buffer easily enough
Then you've figured out what you need to do.

Quote
but is there some way of the original terminator being transferred to the buffer on read so it is already in the right place to send on.
Sure. Rewrite the readBytesUntil() method of the Stream class to suit your unique needs.
Logged

Pages: [1]   Go Up
Jump to: