• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Opposite of CString::Format ?

CString oTime;
SYSTEMTIME st;
oTime.Format("%02d/%02d/%04d %02d:%02d PM",st.wDay, st.wMonth, st.wYear,st.wHour-12, st.wMinute);      

Is there any simple way to "Un"Format a CString and get back all values to a SYSTEMTIME structure? I need
this structure to do sorting. I don't think I want to manually extracts the value from the CString one by one and
make comparison between the years...then months..... it's extremely tedious.. I believe there is a simpler way to
do that, could anyone please enlighten me?
0
zhenteng
Asked:
zhenteng
1 Solution
 
SlartiCommented:
Use sscanf:
sscanf((const char*)oTime, "%d %d etc.", &st.wDay, &st.wMonth ...);
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now