title: Last modified date of a file into a string c++
body: <p>I am working on a script that will delete files from a folder that was modified over a week ago and i am having trouble with getting the last modified date into a string.</p>
  
  <p>So I am trying to write the last modified date of a file to a string vector.</p>
  
  <p>The bolded line is the error line, it says </p>
  
  <blockquote>
    <p>||=== Build: Debug in WeekaDelete (compiler: GNU GCC Compiler) ===|
    \WeekaDelete\main.cpp||In function 'int main(int, char**)':|
    \WeekaDelete\main.cpp|21|error: cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&amp;&amp;'|
    codeblocks\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream|602|error:   initializing argument 1 of 'std::basic_ostream&lt;_CharT, _Traits>&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits>&amp;&amp;, const _Tp&amp;) [with _CharT = char; _Traits = std::char_traits; _Tp = _FILETIME]'|
    ||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|</p>
  </blockquote>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;vector&gt;
  #include &lt;ctime&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  int main(int argc, char* argv[])
  {
      WIN32_FIND_DATA search_data;
      memset(&amp;search_data, 0, sizeof(WIN32_FIND_DATA));
      HANDLE handle = FindFirstFile("C:\\Users\\Meikle-John\\Desktop\\CoastWideCivil\\C++\\Scans\\*",         &amp;search_data);
      int ifilecount = -2;
      vector&lt;string&gt; vsname, vsdate;
      string tempn, tempd;
      while(handle != INVALID_HANDLE_VALUE)
      {
          tempn = search_data.cFileName;
          **tempd = search_data.ftLastAccessTime;**
          cout &lt;&lt; tempd &lt;&lt; endl;
          cout &lt;&lt; tempn &lt;&lt; " : " &lt;&lt; tempd &lt;&lt; endl;
          cout &lt;&lt; ifilecount++ &lt;&lt; endl;
          if(ifilecount &gt; -1)
          {
              vsname.push_back(tempn);
              vsdate.push_back(tempd);
          }
          if(FindNextFile(handle, &amp;search_data) == FALSE)
          {
              break;
          }
      }
      //Close the handle after use or memory/resource leak
      FindClose(handle);
      cout &lt;&lt; "There are:" &lt;&lt; ifilecount &lt;&lt; " Files in this directory" &lt;&lt; endl;
      return 0;
  }
  </code></pre>