• Advertisement

Archived

This topic is now archived and is closed to further replies.

Plz help verify wsvprintf bug

This topic is 6762 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is a wild guess but wouldn't the '\n' character also show up as an character in strlen. Because to my knowledge strlen only stops counting at the '\0' null-terminating character, but returns the stringlength with special characters included.

Share this post


Link to post
Share on other sites
Advertisement
Yes '\n' would show up but wvsprint didn't take that char into account when it formats the string.

So unless strlen shouldn't be used to calculate the format control string, the docs are wrong. But what else if not strlen?

Share this post


Link to post
Share on other sites
Hi,

for the variable argument formatting function in windows, wsvprintf, the docs says that if an error occurs, the functions returns a value lesser than the length of the format-control string.

But if the formatting string is as such

wsvprintf(buffer,"%d\n",va_list);

and the value is a single digit, say 8, the return value is 2 although strlen of the control string is 3. So either this is a bug or strlen shouldn't be used. Someone plz explain.

Thanks.

Share this post


Link to post
Share on other sites

  • Advertisement