Thanks again, Guy. I'll think about it for a bit, but that's very
possibly what I'll do.
On Wed, Jun 2, 2010 at 6:57 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:
>
> On Jun 1, 2010, at 10:10 PM, Ian Schorr wrote:
>
>> As you mention later, MS Visual Studio 2008 does not include those
>> macros. From the sounds of it, regardless of my exact problem (which
>> I'm guessing is in this general area anyway), I'm probably better off
>> abandoning sprintf altogether?
>
> If you have guint32 and guint64 as types, you're presumably using GLib, in which case you have GStrings:
>
> http://library.gnome.org/devel/glib/stable/glib-Strings.html
>
> which means you can allocate a GString, use g_string_printf() to initially format it, and use g_string_append_printf() to format and append to it; there aren't any worries about overflowing it, as it grows as necessary, or about conveniently appending to it.
>
> If you use that, you'd use G_GINT64_MODIFIER in the format, e.g.
>
> GString *string;
> guint64 longlong;
>
> ...
>
> g_string_printf(string, "longlong = " G_GINT64_MODIFIER "u", longlong);
>
> That's available on all platforms, so you don't have to worry about whether the platform has the PRI[douxX]64 macros or not.
> ___________________________________________________________________________
> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives: http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>