5

[SOLVED] puts(rubbish)...

view full story
linux-howto

http://www.linuxquestions.org – Yes, that's what it does for some reason. The code below prints garbage if I use puts() but it is fine if I use printf() instead (see sample of output at the bottom of this post). Any idea what could be causing this? The odd thing is that the mess always starts after exactly eight properly printed characters. That sort of regularity can't be a coincidence, can it? It almost looks like an encoding issue (I'm using UTF-8) but if it really is, then I don't understand why the printf() is unaffected. Code: #include <stdio.h> #include <string.h> (HowTos)