Skip to main content

ostringstream is the perfect C++ replacement for sprintf, except...

Published 1 min readMarkdown
Part of seriesTechnical Blog

ostringstream is the perfect C++ replacement for sprintf, except for trying to debug its contents in Visual Studio.Add this to Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers\stl.natvis:

<Type Name="std::basic_ostringstream<char,*>"> <DisplayString>{_Mystrbuf->_Gfirst},s</DisplayString> <StringView>_Mystrbuf->_Gfirst,s</StringView> <Expand> <Item Name="[state]">_Mystate</Item> <ExpandedItem>_Mystrbuf->_Gfirst</ExpandedItem> </Expand> </Type>

No comments yet. Be the first to comment.

More from this blog