Hi,
I am working on a little example that Bascily scans a Path and grabs all the file names, then store them into an array. Anyway most of the code is working find all expect the last part were I need to display the output.

I left a copy of all my code below and commented. it

VB Code:
  1. #include <iostream>
  2. #include <fstream>
  3. #include <windows.h>
  4. using namespace std;
  5.  
  6. int main(int agvc)
  7. {
  8.    WIN32_FIND_DATA fd;
  9.    HANDLE FindFile;
  10.    int cnt=0;
  11.    char findPath[80];
  12.    char **Filename;
  13.  
  14.    strcpy(findPath,"C:\\*.*"); // path to scan
  15.    FindFile = FindFirstFile(findPath, &fd); // Get first file handle
  16.    
  17.    if(FindFile == INVALID_HANDLE_VALUE)
  18.    {
  19.       // oops error
  20.       cout << "INVALID_HANDLE_VALUE\n";
  21.       exit(1);
  22.  
  23.    }
  24.  
  25.    do{
  26.       if((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  27.          == FILE_ATTRIBUTE_DIRECTORY) continue;
  28.  
  29.       // is it possiable I am doing something wrong here.
  30.       Filename = (char**) malloc(cnt); // Reszie arry to hold the filenames
  31.       Filename[cnt] = fd.cFileName; // store filename
  32.       cnt++;
  33.  
  34.    }while(FindNextFile(FindFile,&fd));
  35.    FindClose(FindFile); // close file handle
  36.    
  37.    std::cout << Filename[0] << endl; // Why is this giveing an error
  38.  
  39.    return 0;
  40. }

If anyone can help I whould be very greatfull