|
Boost : |
From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-05-17 07:25:16
John Nagle wrote:
> That's an older version, though; the strings have
>no length field, and you said you were putting one in.
>Should I do that?
I have been busy with other things. I have finally gotten around to updating
the code, which now includes:
* internal length tracking
* null-termination as a given (i.e. it will no longer work in data
structure headers for signature checking, etc.)
* safe_strings.hpp uses your strategy of putting the C-string functions in
the global namespace (I would have liked a better approach to this).
#include <boost/fixed_string/safe_strings.hpp>
// ...
boost::char_string< 15 > cstr;
strcpy( cstr, "Meine Grosse Welt!" );
std::cout << cstr << '\n';
sprintf( cstr, "Hello %d Worlds!", 10 );
std::cout << cstr << '\n';
Results in:
Meine Grosse W
Hello 10 World
Regards,
Reece
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk