std::string format
-
Hi, if we use cstring like, CString errorDescription; errorDescription.Format(L"Connected to %s\\%ld", m_hostAddress(/*cstring type*/),Literals::CONFIGURATION_SERVER_PORT(/*int type*/)); here,instead of cstring if i use std::string errorDescription, then how the above format can be done? thanx.
-
Hi, if we use cstring like, CString errorDescription; errorDescription.Format(L"Connected to %s\\%ld", m_hostAddress(/*cstring type*/),Literals::CONFIGURATION_SERVER_PORT(/*int type*/)); here,instead of cstring if i use std::string errorDescription, then how the above format can be done? thanx.
Take a look at this article[^]
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
Hi, if we use cstring like, CString errorDescription; errorDescription.Format(L"Connected to %s\\%ld", m_hostAddress(/*cstring type*/),Literals::CONFIGURATION_SERVER_PORT(/*int type*/)); here,instead of cstring if i use std::string errorDescription, then how the above format can be done? thanx.
You can use ostringstreams as described in the previous reply, or you could use Boost.Format[^], which gives you an interface more like
CString::Format
.Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!