View previous topic :: View next topic |
Author |
Message |
sandy wilson
Joined: 25 Feb 2004 Posts: 28
|
NUL characters in arrays |
Posted: Mon May 10, 2004 5:33 am |
|
|
Hello Everybody,
does anybody know of any problems with using the NUL character (0x00)in arrays using the CCS compiler version 3.089.
We are using an array to receive characters through RS485 and everything seems to work ok untill a NUL is sent then it all goes to Pot. No code posted as this is just a general [spam] for clues.
thanks
Sandyw |
|
|
Ttelmah Guest
|
Re: NUL characters in arrays |
Posted: Mon May 10, 2004 5:52 am |
|
|
sandy wilson wrote: | Hello Everybody,
does anybody know of any problems with using the NUL character (0x00)in arrays using the CCS compiler version 3.089.
We are using an array to receive characters through RS485 and everything seems to work ok untill a NUL is sent then it all goes to Pot. No code posted as this is just a general [spam] for clues.
thanks
Sandyw |
Obvious comment.
In C, the 0 character is used as the 'end of string' marker. If you are storing characters into an array, and then trying to use any of the string functions on these (including things like %s in the printf statement), the string will be treated as terminating at this point.
Other than this, no. I have used RS485 block based transmissions, sending/receiving binary values including 0, with no problems at all.
Best Wishes |
|
|
sandy wilson
Joined: 25 Feb 2004 Posts: 28
|
Null characters in arrays |
Posted: Tue May 11, 2004 1:47 am |
|
|
Thank you Ttelmah,
The obvious was the problem. We were using a strcpy() for copying the arrays so it stopped when it reached 0x00.
These thing happen.
Thanks
Sandyw |
|
|
Ttelmah Guest
|
Re: Null characters in arrays |
Posted: Tue May 11, 2004 1:52 am |
|
|
sandy wilson wrote: | Thank you Ttelmah,
The obvious was the problem. We were using a strcpy() for copying the arrays so it stopped when it reached 0x00.
These thing happen.
Thanks
Sandyw |
At least it was easy to find.
Glad it is working now.
Best Wishes |
|
|
|