|
Did you search this title on the internet" Socket Programming in c/c++"?
|
|
|
|
|
Yes i got it now ... sorry was busy with my work ...
now i am going through practices
|
|
|
|
|
So you are lucky that you have work .
|
|
|
|
|
CString str;
str.Format("Value %d",m_nSides);
What is the other way to format a string NOT using CString methods?
|
|
|
|
|
In C style.
char sTmp[30] = {0};
sprintf(sTmp, "Value %d", m_nSides);
Maxwell Chen
|
|
|
|
|
using std::string maybe ?
what don't you like in CString ?
|
|
|
|
|
For ATL program with no MFC support.
|
|
|
|
|
CString is a ATL class, extended to MFC. but still you can use it in ATL.
|
|
|
|
|
Unable to use it.
error C2065: 'CString' : undeclared identifier
|
|
|
|
|
What version of Visual C++ are you using?
Maxwell Chen
|
|
|
|
|
|
OK. You chose not to support MFC in the project settings.
You can use the C style formatting.
If you need to treat strings as objects, you can use std::string from <string> header. But the format way differs.
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: you can use std::string from <string> header. But the format way differs
sure it does, there's no format() function in the STL's string class.
but Boost provides one.
however, in case you didn't read the whole thread, CString is a ATL class, so it is still usable in a ATL project...
|
|
|
|
|
toxcct wrote: however, in case you didn't read the whole thread, CString is a ATL class, so it is still usable in a ATL project...
I just created an ATL project (EXE) with VC++ 2005.
No it does not recognize CString.
Error C2065: 'CString' undeclared identifier.
#include <altstr.h>
Maxwell Chen
|
|
|
|
|
Ok., why using CString causes error?Is there any header file is missing?
|
|
|
|
|
#include <atlstr.h>
Maxwell Chen
|
|
|
|
|
Ya!! it solves the problem!
|
|
|
|
|
include the correct header buddy !
|
|
|
|
|
#include <atlstr.h>
Thanks!
Maxwell Chen
|
|
|
|
|
Sakthi_Vel wrote: For ATL program with no MFC support.
Starting from Visual C++ .NET, I think that ATL and MFC have merged together.
Maxwell Chen
|
|
|
|
|
Try using std::stringstream or boost::format[^]!
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
1) please read the thread before answering
2) what you suggest has already been proposed
3) CString works fine however, as it is an ATL class though.
|
|
|
|
|
toxcct wrote: 1) please read the thread before answering
Guilty
toxcct wrote: 2) what you suggest has already been proposed
Not really - you did just barely mention it with: "but Boost provides one".
I gave the link
toxcct wrote: 3) CString works fine however, as it is an ATL class though.
Thats true, but he explicitly asked for formating other than using CString but for the wrong reason
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
|
I need to free memory in CMyListCtrl.
void CMyListCtrl::OnDestroy()
{
UnInit();
CListCtrl::OnDestroy();
}
It's ok, but the comments says to add code after called CListCtrl::OnDestroy
So I try to find another way
BOOL CMyListCtrl::DestroyWindow()
{
UnInit();
return CListCtrl::DestroyWindow();
}
But it is not called by the framework.
Where should I do UnInit in this sample?
|
|
|
|