Quick question about strsafe.h functions
Hi,
I'm not quite sure I understand MSDN about using the strsafe.h functions. Let's use StringCbPrintf as an example.
I'm particularly worried about the CbDest parameter, which is the size of the destination buffer (in bytes). If I have a character array 256 bytes long, do I use 256 or 255?
Quote:From the linked page
cbDest
[in] Size of the destination buffer, in bytes. This value must be sufficiently large to accommodate the final formatted string plus the terminating null character.
So in your case, you should use 256.
Why bother with all of those? They're a nasty hack to try to post-fix bad string habits rooted in language practices that are crufty and old...
I'd recommend strstream and the like, covered with convenience functions if need be.
I'd recommend strstream and the like, covered with convenience functions if need be.
Quote:Original post by JasonBlochowiak
Why bother with all of those? They're a nasty hack to try to post-fix bad string habits rooted in language practices that are crufty and old...
I'd recommend strstream and the like, covered with convenience functions if need be.
QFT
Although I'm sure you meant std::stringstream/boost::format.
Quote:Original post by jflanglois
Although I'm sure you meant std::stringstream/boost::format.
Why, yes, indeed I did. :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement