N
novice
How can I do string operation for numeric data?
For example I'd like to cut the numeric data.
long nDate = 20040307; //Year = 2004, Month = 03, Day = 07
CString strDate, strYear, strMonth, strDay;
strDate.Format("%d", nDate);
strYear = strDate.Left(4);
strMonth = strDate.Mid(4,2);
strDay = strDate.Right(2);
In above example, I can cut the numeric data as string.
But how can I use the value of CString as numeric data?
I'd like to pass the each value to CTime variable like this.
CTime tTime (strYear, strMonth, strDay, nTime, nMinute, nSecond);
-------- -------- ------
Error! Error! Error!
(int)(LPCTSTR)strYear doesn't work either.
Any comments would be greatly appreciated.
john
For example I'd like to cut the numeric data.
long nDate = 20040307; //Year = 2004, Month = 03, Day = 07
CString strDate, strYear, strMonth, strDay;
strDate.Format("%d", nDate);
strYear = strDate.Left(4);
strMonth = strDate.Mid(4,2);
strDay = strDate.Right(2);
In above example, I can cut the numeric data as string.
But how can I use the value of CString as numeric data?
I'd like to pass the each value to CTime variable like this.
CTime tTime (strYear, strMonth, strDay, nTime, nMinute, nSecond);
-------- -------- ------
Error! Error! Error!
(int)(LPCTSTR)strYear doesn't work either.
Any comments would be greatly appreciated.
john