|
-
April 7th, 2012, 10:39 PM
#1
C++ version of sscanf, sprintf, etc?
Are there C++ equivalents of sscanf and sprintf functions that takes a pointer to the C++ string class as the argument?
Also what's the C++ equivalent of printf to do formatted output? Thanks!
-
April 7th, 2012, 10:51 PM
#2
Re: C++ version of sscanf, sprintf, etc?
 Originally Posted by acppdummy
Are there C++ equivalents of sscanf (...) functions that takes a pointer to the C++ string class as the argument?
Not that I know of, so you might either use a stringstream, or create a std::string s with the desired size and then pass &s[0] as an argument to sscanf (but then be warned about the danger of buffer overflow, plus you need to account for the null terminator).
 Originally Posted by acppdummy
what's the C++ equivalent of printf to do formatted output?
You can use Boost.Format for something similiar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|