Newbie
the read() & write(int) work with binary value. Now to your code. It's much clearer if you code as following:
if((readChar=='$' ||charCount>0) && readChar!='A') {...}
if (readChar == 'A'...