"Joseph Suprenant" <la******@yahoo.com> wrote in message
news:vx********************@twister.nyroc.rr.com.. .
| Quick question hope someone can help.
| I am sending a file accross a radio, i am limited to using only chars. I
| get all the data on the receiving end but everytime it gets a 0x00 it is
| treated as a 0x20 (ascii whitespace). SO when i go to print it out and
view
| my file my file is messed up just a little bit. Anyone have any ideas?
Maybe your transmission system does not support sending a 0x00,
so some code automatically replaces it with a 0x20.
What you could do is to somehow encode your data to avoid occurrences
of 0x00, or use a filter to generate escaped character sequences.
For example, using '/' as an escape character:
on the sending end:
switch( charToBeSent ) {
case 0x00: send('/'); send('z'); break;
// ... more escaped chars ...
case '/' : send('/'); send('/'); break;
default: send(charToBeSent); break;
}
on the receiving end:
char received = read();
if( received =='/' ) {
received = read(); // get next character
switch( received ) {
case 'z' : received = 0x00;
// ... more escaped chars ...
case '/' : /* -> ok: same char */
default: break;
}
}
hth-Ivan
--
http://ivan.vecerina.com