This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
A sniprintf question
- From: Artur Lipowski <LAL at pro dot onet dot pl>
- To: newlib at sources dot redhat dot com
- Date: Thu, 14 Aug 2008 21:57:05 +0200
- Subject: A sniprintf question
Hi,
Is it expected that sniprintf in subsequent calls somehow "appends" data to
existing buffer?
E.g.
for (i=0; i<2; i++)
{
sniprintf(ui_buffer, sizeof(ui_buffer),
"SSID: %-8s freq: %lu00Hz RSSI: %3udB type: %u %-6s MAC:
%02X:%02X:%02X:%02X:%02X:%02X\n\r",
(const char*)ssid, freq, rssi, type,
is_secure ? "secure" : "open",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
USART_puts(console, ui_buffer);
}
Then output is multiplied (except the last line when i == 1).
If I put:
ui_buffer[0] = '\0';
before sniprintf then output looks good.
BTW> ui_buffer is 256 bytes long, USART_puts is blocking (synchronous) call and
newlib snapshot is from 25.07.2008
Regards,
--
Artur Lipowski