Re: iovecs don't print right



nobody+cplusplus wrote:

Stephane CHAZELAS wrote:

2008-07-05, 03:51(+09), nobody+cplusplus:
[...]
printf ("len %d, %d: %s \n", (int) iov[i].iov_len, i, (char *) \
iov[i].iov_base );
[...]
What wrong am i doing here? :/
[...]

You're using printf("%s") on something that is not a
zero-terminated string.

FYI, hence (void*)->(char*) for iov[i].iov_base
anything else?

OK somehow using printf("%.<precision>s",..) does the trick (as the max
characters is 16, <precision> = 16. But this is a ugly hack at best. Is
there better way of doing it?


--
thanks
.