We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use mbuf_printf in this way:
mbuf_printf
{ struct odict* result_dict; struct mbuf* mb_ref = NULL; int64_t result = 0; mb_ref = mbuf_alloc(1024); if (!mb_ref) { DEBUG_WARNING("ENOMEM.\n"); } char *flvname = "512aaaa"; EOR(odict_alloc(&result_dict, 16)); EOR(odict_entry_add(result_dict, "name", ODICT_STRING, flvname)); mbuf_printf(mb_ref, "%H", json_encode_odict, result_dict); char buf[1024]; re_snprintf(buf, sizeof(buf), "%H", json_encode_odict, result_dict); DEBUG_WARNING("mbuf:%s\nbuf:%s\n", mbuf_buf(mb_ref), buf); }
I run it on ubuntu(x86_64), the result is:
buf has the right value, the mb_ref don't have the right value. I have check mbuf_printf example in reTest. This is why? Thank you.
buf
mb_ref
The text was updated successfully, but these errors were encountered:
mbuf buf is a binary buffer , it is not null terminated and you can not use %s to print it
You can for example use %b instead:
re_printf("mbuf: %b\n", mb->buf, mb->end);
Alfred
Sorry, something went wrong.
@alfredh Thank you. I fix it.
No branches or pull requests
I use
mbuf_printf
in this way:I run it on ubuntu(x86_64), the result is:
buf
has the right value, themb_ref
don't have the right value. I have checkmbuf_printf
example in reTest.This is why? Thank you.
The text was updated successfully, but these errors were encountered: