is there a list of format types?

Tips and tricks for POCO C++ Libraries users.
lrleon
Posts: 3
Joined: 13 Sep 2015, 02:06

is there a list of format types?

Postby lrleon » 06 Oct 2015, 01:02

Hi

First that all, I'm newbie with poco. But until now, it is a very beautiful and useful library.

Well, I' working with loggers and and for a specific need I use the `uint64_t` type for representing persistent logic clocks.

I have the following code snippet:

Code: Select all

log.notice("log seq number = %d act seq number = %d",
        log_seq_number, activity_seq_number);


which does not print the numbers. The output is

Code: Select all

recollector-log: Notice: log seq number = [ERRFMT] act seq number = [ERRFMT]


What evidently suggests a bad format specifier. The problem is that I do not find the doc describing the possibles formats.

Could someone help me?

Thanks in advance,

Leandro

alex
Posts: 1375
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: is there a list of format types?

Postby alex » 06 Oct 2015, 06:52

Try "%Lu" format.

lrleon
Posts: 3
Joined: 13 Sep 2015, 02:06

Re: is there a list of format types?

Postby lrleon » 13 Oct 2015, 18:03

That has worked!

Thanks

Leandro

setsu
Posts: 12
Joined: 12 Jan 2008, 11:29
Location: Japan

Re: is there a list of format types?

Postby setsu » 05 Apr 2016, 02:12

There is a table in this page:
http://poco.roundsquare.net/2010/05/09/pocoformat/
# search for "Parameter Type" in the page.

Here goes the HTML source code for the table:

Code: Select all

<table border="1">
<tbody>
<tr>
<th style="text-align:center;">Parameter Type</th>
<th colspan="2" style="text-align:center;">fmt</th>
</tr>
<tr>
<td>bool</td>
<td>%b</td>
<td rowspan="12" style="vertical-align:middle;text-align:center;">%?i</td>
</tr>
<tr>
<td>char</td>
<td>%c</td>
</tr>
<tr>
<td>int</td>
<td>%d, %i</td>
</tr>
<tr>
<td>unsigned</td>
<td>%u</td>
</tr>
<tr>
<td>short</td>
<td>%hd</td>
</tr>
<tr>
<td>unsigned short</td>
<td>%hu</td>
</tr>
<tr>
<td>long</td>
<td>%ld</td>
</tr>
<tr>
<td>unsigned long</td>
<td>%lu</td>
</tr>
<tr>
<td>long long</td>
<td>%Ld</td>
</tr>
<tr>
<td>unsigned long long</td>
<td>%Lu</td>
</tr>
<tr>
<td>unsigned (octal)</td>
<td>%o</td>
</tr>
<tr>
<td>unsigned (hex)</td>
<td>%x, %X</td>
</tr>
<tr>
<td>double</td>
<td colspan="2">%f, %e, %E</td>
</tr>
<tr>
<td>float</td>
<td colspan="2">%hf, %he, %hE</td>
</tr>
<tr>
<td>std::string</td>
<td colspan="2">%s</td>
</tr>
<tr>
<td>std::size_t</td>
<td colspan="2">%z</td>
</tr>
</tbody>
</table>

john21wall
Posts: 2
Joined: 20 Apr 2016, 10:32
Contact:

Re: is there a list of format types?

Postby john21wall » 20 Apr 2016, 14:49

Thanks so much for helping to solve the problem I had.

Davidsmith150
Posts: 1
Joined: 15 Nov 2016, 11:27

Re: is there a list of format types?

Postby Davidsmith150 » 15 Nov 2016, 11:29

Thanks "%Lu" its worked.


Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests

cron