Page 1 of 1

sprintf

Posted: Mon Feb 24, 2014 7:17 pm
by Tabulous
am i right in thinking if i want sprintf support, i should use chsnprintf ?

if so ive added memstreams.c to makefile and this is how im calling it

struct tm t;
static char msgstr1[100];
static const char LOGFILE_ENTRY_FORMAT[] = {"[%.2d/%.2d/%.2d - %.2d:%.2d:%.2d.%.3d] - [%.4d] %s\r\n"};


rtcGetTimeTm( &RTCD1, &t );

chsnprintf( msgstr1,
sizeof(msgstr1),
LOGFILE_ENTRY_FORMAT,
t.tm_mday, t.tm_mon - 1, t.tm_year - 100,
t.tm_hour, t.tm_min, t.tm_sec, (int)0,
(const char *)"This is a debug test message");



but just get unhandled exception and dbg_panic_msg is NULL ??

Re: sprintf

Posted: Mon Feb 24, 2014 8:12 pm
by Giovanni
Unhandled exceptions do not return messages being unexpected.

I think it is because you have 9 %x but you give only 8 arguments.

Giovanni

Re: sprintf

Posted: Mon Feb 24, 2014 8:40 pm
by Tabulous
Giovanni wrote:Unhandled exceptions do not return messages being unexpected.

I think it is because you have 9 %x but you give only 8 arguments.

Giovanni


opps sorry thats my bad :0