Hi, I have to open and read multiple files which are in same folders. I can search and collect the whole size of those files. But the problem is with when I'm copying the files to a buffer. How can I read the multiple files? I'm using this example for checking the multiple files. I can get the size but can't seem to open and read. Any ideas?
I'm using this example for searching the files:
http://msdn.microsoft.com/en-us/library/aa365200%28v=vs.85%29.aspx

Could you post your code for opening and reading the files? What specific problems are you having?

Hi This is what I'm doing after searching for files and getting total memory:

FileHandle fh;
FileError ferror;
unsigned char *Buff = new unsigned char[totalSize];

fh = FindFirstFile("*.bin", &FindFileData);

if(fh == INVALID_HANDLE_VALUE) {

  printf("Not founded");
}
else {
  printf("Found: %s", FindFileData.cFileName);
}

do
 {
   if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
  {

    printf("\nFound: %s\n", FindFileData.cFileName);
  }
  else
  {
     ferror = File::open(fh, FindFileData.cFileName, FILE_READ);
     ferror = File::read(fh, Buff, totalSize);
  }
 }
 while (FindNextFile(fh, &FindFileData) != 0);

I'm getting a breakpoint whenever I'm creating a buffer with total memory. Is this the right to read the multiple files?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.