Mam nastepujacy problem, a odpowiedzi nie moge znalezc w google.
Chodzi o funkcje FindFirst,FindNext.. itp
Jak je obsluzyc tzn dokladnie potrzebuje skopiowac wszystkie nazwy plikow z danego folderu do tablicy statycznej?
Przeszukiwanie folderu[c++]
-
- Użytkownik
- Posty: 346
- Rejestracja: 17 cze 2008, o 22:01
- Płeć: Mężczyzna
- Lokalizacja: Krk
- Podziękował: 41 razy
- Pomógł: 17 razy
Przeszukiwanie folderu[c++]
rozwiklalem problem:
#include
#define WIN32_LEAN_AND_MEAN
#include
#include
#include
//#include
#include
#include
#include
#include
WIN32_FIND_DATA ffd;
char* cSciezka="C:\\Windows\\Fonts";
char* Tablica[5000]={0,};
LARGE_INTEGER filesize;
TCHAR szDir[MAX_PATH];
size_t length_of_arg;
HANDLE hFind = INVALID_HANDLE_VALUE;
DWORD dwError=0;
UINT i=0;
// If the directory is not specified as a command-line argument,
// print usage.
// Check that the input path plus 2 is not longer than MAX_PATH.
StringCchLength(cSciezka, MAX_PATH, &length_of_arg);
//MessageBox(NULL,"Target directory is","xd",NULL);
// Prepare string for use with FindFile functions. First, copy the
// string to a buffer, then append '\*' to the directory name.
StringCchCopy(szDir, MAX_PATH, cSciezka);
StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
// Find the first file in the directory.
hFind = FindFirstFile(szDir, &ffd);
// List all the files in the directory with some info about them.
do
{
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
continue;
}
else
{
filesize.LowPart = ffd.nFileSizeLow;
filesize.HighPart = ffd.nFileSizeHigh;
//MessageBox(NULL,ffd.cFileName,"o",NULL);
Tablica=ffd.cFileName;
++i;
}
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
#include
#define WIN32_LEAN_AND_MEAN
#include
#include
#include
//#include
#include
#include
#include
#include
WIN32_FIND_DATA ffd;
char* cSciezka="C:\\Windows\\Fonts";
char* Tablica[5000]={0,};
LARGE_INTEGER filesize;
TCHAR szDir[MAX_PATH];
size_t length_of_arg;
HANDLE hFind = INVALID_HANDLE_VALUE;
DWORD dwError=0;
UINT i=0;
// If the directory is not specified as a command-line argument,
// print usage.
// Check that the input path plus 2 is not longer than MAX_PATH.
StringCchLength(cSciezka, MAX_PATH, &length_of_arg);
//MessageBox(NULL,"Target directory is","xd",NULL);
// Prepare string for use with FindFile functions. First, copy the
// string to a buffer, then append '\*' to the directory name.
StringCchCopy(szDir, MAX_PATH, cSciezka);
StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
// Find the first file in the directory.
hFind = FindFirstFile(szDir, &ffd);
// List all the files in the directory with some info about them.
do
{
if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
continue;
}
else
{
filesize.LowPart = ffd.nFileSizeLow;
filesize.HighPart = ffd.nFileSizeHigh;
//MessageBox(NULL,ffd.cFileName,"o",NULL);
Tablica=ffd.cFileName;
++i;
}
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);