hi guys,

used the code provided by msn. however, when i try to hard code the 
files/directory to look for. it generates an error. can you please 
help me?

= = = =

#include <windows.h>
#include <tchar.h>
#include <stdio.h>

void _tmain()
{
   WIN32_FIND_DATA FindFileData;
   HANDLE hFind;

   //if( argc != 2 )
   //{
   //   _tprintf(TEXT("Usage: %s [target_file]\n"), argv[0]);
   //   return;
   //}

   TCHAR *argv[]="";

   _tprintf (TEXT("Target file is %s\n"), argv[1]);
   hFind = FindFirstFile(argv[1], &FindFileData);
   if (hFind == INVALID_HANDLE_VALUE) 
   {
      printf ("FindFirstFile failed (%d)\n", GetLastError());
      return;
   } 
   else 
   {
      _tprintf (TEXT("The first file found is %s\n"), 
                FindFileData.cFileName);
      FindClose(hFind);
   }
}

= = = =

Reply via email to