[En-Nut-Discussion] %P in putf.c
Dusan Ferbas
dferbas at dfsoft.cz
Thu Dec 11 17:32:31 CET 2003
Hi Ralph,
I tried to use your %P enhancement. When used with sprintf it works. When
used with stream fprintf it sometimes does not work ? Because whole or part
of some fprintf is lost (packet sniffer used just to be sure). Did somebody
encounter something similar ?
When no %P is used then output stream is perfect ('#if 1' case - see below).
Thread has 1536 bytes stack size. Its usage can be monitored with html page
similar to basemon's 'Nut/OS Threads'.
Example of call:
PrintXmlLine(stream,SysContact_P, gBoardDatap->sysContact);
---------
static void PrintXmlLine(FILE *stream, const prog_char * tag_Pp, u_char *argp)
{
#if 1
u_char tag_buf[100];
strncpy_P(tag_buf, tag_Pp, 100);
fprintf_P(stream, PSTR("<%s>%s</%s>\n"), tag_buf, argp, tag_buf);
#else
fprintf_P(stream, PSTR("<%P>%s</%P>\n"), tag_Pp, argp, tag_Pp);
#endif
}
////////////////////////////////////////////////////////////////////////////////
//formatovaci retezec i argument jsou ve flashce
static void PrintXmlLine_P(FILE *stream, const prog_char * tag_Pp, const
prog_char * arg_Pp)
{
#if 1
u_char arg_buf[50];
strncpy_P(arg_buf, arg_Pp, 50);
PrintXmlLine(stream, tag_Pp, arg_buf);
#else
fprintf_P(stream, PSTR("<%P>%P</%P>\n"), tag_Pp, arg_Pp, tag_Pp);
#endif
}
Dusan Ferbas
www.dfsoft.cz
More information about the En-Nut-Discussion
mailing list