Compare 2 dates from strings,char* or int

i have a problem here, i have been trying to compare a date format from SYSTEMTIME and a date from a text file(string).But its not working. I tried to change both to string(using osstringstream),char* and int(using sscanf) to do the comparison but with no luck. its pretty simple all i want to do is get the current system date and compare it with the date from the text file. Below is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
char szcurrentDate[MAX_PATH] = "";
            char szdate_time[MAX_PATH];
            SYSTEMTIME  st;
            GetLocalTime (&st);
            GetDateFormat(LOCALE_USER_DEFAULT,NULL,&st,"yyyy-M-d ",szcurrentDate,MAX_PATH);  //current system date

            //std::ostringstream mm;
            //stringstream mm;
            //mm << szcurrentDate;
            MessageBoxA(NULL,szcurrentDate, "Attention", IDOK == IDCANCEL);


         ifstream ifs(szFile);
         string line;  
         while ( !ifs.eof() )     
         {    
           getline(ifs, line); 
               if((line.find("TESTING_GET_DATE:") != string::npos))
                      {
                            std::string str = line.substr(17,9); // substract TESTING_GET_DATE: 2014-3-16 to  2014-3-16
                            strcpy(szdate_time, str.c_str());

               if (szcurrentDate == szdate_time) 
                        {

                            MessageBoxA(NULL,"Same","Attention",MB_OK);
                        }
               else
                        {
                            MessageBoxA(NULL,"blablabla","Attention",MB_OK);
                        }


note : i tried displaying just szcurrentDate and szdate_time they show the date exactly the same. in string,char* or int formats.
You are comparing pointers to string instead of string content. Use specific c-string comparsion functions (You used strcpy(szdate_time, str.c_str()) instead of szdate_time = str.c_str() but forgot about comparsion?)
yes, i tried changing it to (szcurrentDate == str) and that worked
Topic archived. No new replies allowed.