Are your strings null terminated? That is, are you sure they have an '\0' at the end of them? strcat, I think, looks for the null and then expands from there. I'm not sure what it does when it cannot find one. Also, you might want to consider strncat, I think that's a little "safer".

Regards,
Kurt
From: <[EMAIL PROTECTED]>
To: [email protected]
Subject: [Tinyos-help] The string becomes unrecoginizable after some stringoperation
Sent: Thursday, November 22, 2007 12:30 AM
Dear all,

I found that the string under nesc, once being processed by some string functions, for example, strcat() and strcpy(), will become totoally disordered and unrecognizable.

for example:
aFunction(*OriginalData)
{
 char DataToSend[50];
 strcpy(DataToSend,OriginalData);
 strcat(DataToSend,"}"};
//here if I print DataToSend out, it is totally disordered, but DataToSend if fine.
...
}

I am wondering if there is any restrictions on string processing? Or this does not happen to any of you?

Thank you.
Enric


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to