Wireshark-dev: Re: [Wireshark-dev] g_snprintf
From: wsgd <wsgd@xxxxxxx>
Date: Wed, 26 Aug 2009 20:54:06 +0200
soumya damodaran a écrit :
Hi
Is it possible to display variable length data using g_snprintf? For the 802.11k AP channel report, the channel list is dependent on the tag_len which is variable.
tag_data_ptr = tvb_get_ptr (tvb, offset, tag_len);

strcpy(print_buff, "");
for (i = 0, n = 0; i < tag_len; i++) {
char    print_buff_idx[10];

ret = g_snprintf (print_buff_idx , SHORT_STR ,

"%02X ", tag_data_ptr[i]);
strcat(print_buff, print_buff_idx);

}

proto_tree_add_string (tree, hf_tag_channel_list, tvb, offset, tag_len, print_buff);

right now it is displaying as channel list: <and the last value it is holding>.

i want it to display all the supported channel list as channel list : 1 6 etc. depending on the tag_len.

Please suggest.

Thanks,

Soumya

------------------------------------------------------------------------

___________________________________________________________________________
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