Ok, I'm really confused by this behaviour in VS2008.
This code..
char data[512] = "";
char c[1] = "";
c[0] = '1';
strcat(data, c);
.. results in data
being set to this string value: 1ÌÌÌÌhÿ
Surely it should just be 1
?
How can I ensure data
only contains the single char[] that I copy into it (i.e. 1
)?
Why does strcat()
copy all that garbage? Why does c
even contain that garbage?
Thanks for any help
Edit: Thanks all.