title: How to get File Time in C++
body: <p>i am having a problem in getting the File Time Creation.. could anyone know how to get the FILE time??</p>
  
  <p>I got a code that gets the file name of a certain directory my problem is i dont know how to put the filetimes on each file in the directory...</p>
  
  <p>here is my code: </p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;windows.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;iostream&gt; 
  #include &lt;conio.h&gt;
  #include &lt;sys\types.h&gt;
  #include &lt;sys\stat.h&gt;
  #include &lt;time.h&gt;
  #include &lt;exception&gt;
  #include &lt;WinBase.h&gt;
  
          using namespace std;
  int ifException(string directory) throw()
      {
          DWORD returnvalue;
          returnvalue = GetFileAttributes(directory.c_str());
              if(returnvalue == ((DWORD)-1))
              {
                  return 0;
              }
              else
              {   
                  return 1;
              }
  }
  
  
  
      vector &lt;string&gt; GetPath(string path)
      {
  
  
  
              char directory[9999];
              vector &lt;string&gt; filelist;
              string buffer;
              strcpy_s(directory,path.c_str());
              BOOL checker;
  
  
  
  
                  try
                      {
                          ifException(directory);
  
                      }catch(int i)
                      {   
                          if (i==0)
                          {
                              _getch();
                              exit(1);
                          }
                      }
                  buffer = findFileData.cFileName;
                  filelist.push_back(buffer);
                  checker = FindNextFile(hFind, &amp;findFileData);
                  while(checker)
                  {
                      if(checker == 0)
                      {
                          filelist.resize(filelist.size());
                          return filelist;
                      }
                      checker = FindNextFile(hFind, &amp;findFileData);
                      buffer = findFileData.cFileName;
                      filelist.push_back(buffer);;//save file list in vector
                  }
                  return filelist;
      }
  
      int main()
      {
         string path;
  
         path="C:\\Documents and Settings\\OJT\\My Documents\\game\\FSNPC\\*.*";// the directory
         vector &lt;string&gt; handler;
         handler = GetPath(path);
          for (unsigned i=1;i&lt;handler.size()-1;i++)
          {
              cout &lt;&lt; handler[i]&lt;&lt;endl;//print out the vector
          }
         _getch();
      }
  </code></pre>