When I use
str is a string with size() of 6458, but msg has size() of 1023. What's going on here in strfmt?Code:string msg = strfmt("%s\n", str.c_str());
This is a discussion on Does strfmt("%s",str) has a length restrict? within the C++ Programming forums, part of the General Programming Boards category; When I use Code: string msg = strfmt("%s\n", str.c_str()); str is a string with size() of 6458, but msg has ...
When I use
str is a string with size() of 6458, but msg has size() of 1023. What's going on here in strfmt?Code:string msg = strfmt("%s\n", str.c_str());
strfmt() appears to be non-standard, so you would need to refer to the relevant docs.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Why not use the standard "sprintf" function? Ok, so you have to muck about a bit more to do that, but it should work. Or use the stringstream class to format a string. Both of these solutions should solve the problem.
And funnily enough, the first few references to strfmt() that I could find was this question, so I guess it's a pretty unusual function.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.