 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
novice Guest
|
Posted: Sun Mar 07, 2004 5:16 pm Post subject: String Operation for numeric data |
|
|
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
|
|
| Back to top |
|
 |
Jon Bell Guest
|
Posted: Sun Mar 07, 2004 6:30 pm Post subject: Re: String Operation for numeric data |
|
|
In article <3a63ccda.0403070916.15584cbf (AT) posting (DOT) google.com>,
novice <bjh1004 (AT) hotmail (DOT) com> wrote:
| Quote: |
In above example, I can cut the numeric data as string.
But how can I use the value of CString as numeric data?
|
CStrings are a Microsoft invention, not part of standard C++. Therefore,
you had best ask about them in a Microsoft-specific newsgroup, e.g. one of
the comp.os.ms-windows.programmer.* or microsoft.public.vc.* groups.
--
Jon Bell <jtbellm4h (AT) presby (DOT) edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|