CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

NUL characters in arrays

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sandy wilson



Joined: 25 Feb 2004
Posts: 28

View user's profile Send private message

NUL characters in arrays
PostPosted: Mon May 10, 2004 5:33 am     Reply with quote

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 Confused
Ttelmah
Guest







Re: NUL characters in arrays
PostPosted: Mon May 10, 2004 5:52 am     Reply with quote

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 Confused

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

View user's profile Send private message

Null characters in arrays
PostPosted: Tue May 11, 2004 1:47 am     Reply with quote

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 Embarassed
Ttelmah
Guest







Re: Null characters in arrays
PostPosted: Tue May 11, 2004 1:52 am     Reply with quote

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 Embarassed

At least it was easy to find.
Glad it is working now.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group