After reading your message once again, I stumbled over the words "debugbuf 
keeps the same information as if '...' was a null string"
IMHO if the format string is a null string, the destination buffer should 
contain a null string too and not 'keep the same' (except if it was a null 
string before already).

Anyway, if you just want to compy your constant text into debugbuf (this is 
what your code actually does), you can simply use strcpy() instead. Faster, 
smaller and much less stack usage. :)

JMGross

----- Ursprüngliche Nachricht -----
Von: Jordi Soucheiron
An: [email protected]
Gesendet am: 24 Nov 2009 13:54:25
Betreff: [Mspgcc-users] Problem with sprintf and snprintf in a msp430x2617

Hi,
I've been trying to fix a problem with my build of mspgcc but I got
out of ideas to fix it. Some time ago I used a build from july 2008
and everithing worked just fine, now I've switched to the last cvs
version and I've found out that sprintf for some reason doesn't write
to the destiny. I've tryed to exec this (this line is from the output
of a nesc precompiler):
    snprintf(debugbuf, 256, "  +  Accelerometer Started\n");
But instead of moving the string to the debugbuf keeps the same
information just as if "  +  Accelerometer Started\n" was a null
string.



Reply via email to