Shop OBEX P1 Docs P2 Docs Learn Events
An interesting bug with <cr><lf> and <cr> — Parallax Forums

An interesting bug with <cr><lf> and <cr>

Cluso99Cluso99 Posts: 18,069
edited 2013-02-06 22:01 in Propeller 1
I have been working on File Transfers for another job. However, I have tried a few times to get this running with my PropOS version without success before I had to leave it go. Now I have located the bug and it is an interesting one that could crop up elsewhere, so I thought I would describe it.

Often a program needs to cater for both a <cr> and a <cr><lf> from an external device. Often, we exceute the command once the <cr> is received, and just ignore any <lf> that follows. This is fine in most circumstances.... BUT not always, as I found out - the hard way.

My PropOS executes the command on the <cr> and ignores the <lf>. However, when commencing the FTF (file transfer), I send out an "acknowledge" character to indicate that it is ready. What happens (mostly to my dismay) is that the <lf> is often not removed from the buffer before I send out the "A". Then the <lf> is echoed back out, resulting in the "A" arriving before the <lf> back at the pc end, or the <lf> causes the FTF to terminate on the prop end because it is not expecting this character. In fact, quite often atm it hangs too.

The pc end is a VB6 program, and when debugging of course, everything is slowed down and works fine.
Sign In or Register to comment.