When I run some code on my machine then it behaves as I expect it to.
When I run it on a colleagues it misbehaves. This is what happens.
I have a string with a value of:
croc_data_0001.idx
when I do a strncpy
on the string providing 18 as the length my copied string has a value of:
croc_data_0001.idx♂
If I do the following
myCopiedString[18]='\0';
puts (myCopiedString);
Then the value of the copied string is:
croc_data_0001.idx
What could be causing this problem and why does it get resolved by setting the last char to \0
?