Wireshark mailing list archives
Re: Sprintf weirdness
From: Ian Schorr <ian.schorr () gmail com>
Date: Wed, 2 Jun 2010 20:45:17 +1000
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 () alum mit edu> 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 () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Sprintf weirdness Ian Schorr (Jun 01)
- Re: Sprintf weirdness Eloy Paris (Jun 01)
- Re: Sprintf weirdness Guy Harris (Jun 01)
- Re: Sprintf weirdness Guy Harris (Jun 01)
- Re: Sprintf weirdness Ian Schorr (Jun 01)
- Re: Sprintf weirdness Guy Harris (Jun 01)
- Re: Sprintf weirdness Ian Schorr (Jun 01)
- Re: Sprintf weirdness Guy Harris (Jun 02)
- Re: Sprintf weirdness Ian Schorr (Jun 02)
- Re: Sprintf weirdness Ian Schorr (Jun 01)
- Re: Sprintf weirdness Eloy Paris (Jun 01)
- Re: Sprintf weirdness Jaap Keuter (Jun 01)
- Re: Sprintf weirdness Ian Schorr (Jun 01)