String Operation for numeric data

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
 
J

Jon Bell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,096
Latest member
ThurmanCre

Latest Threads

Top