A
artik009
Я сам вобще не знаток с++ я только учусь но вот мне выдаёт ошибку код в visual c++ 6.0
Вот ошибка такая
А вот код
Вот ошибка такая
Код:
C:\Program Files (x86)\Microsoft Visual Studio\MyProjects\search\by Frank.cpp(11) : error C2601: 'SearchFiles' : local function definitions are illegal
Error executing cl.exe.
А вот код
Код:
#include <iostream.h>
#include <windows.h>
#include <iostream>
void main()
{
typedef void (*LPSEARCHFUNC)(LPCTSTR lpszFileName);
BOOL SearchFiles(LPCTSTR lpszFileName, LPSEARCHFUNC lpSearchFunc, BOOL bInnerFolders = TRUE)
{
LPTSTR part;
char tmp[MAX_PATH];
char name[MAX_PATH];
HANDLE hSearch = NULL;
WIN32_FIND_DATA wfd;
memset(&wfd, 0, sizeof(WIN32_FIND_DATA));
if(bInnerFolders)
{
if(GetFullPathName(lpszFileName, MAX_PATH, tmp, &part) == 0) return FALSE;
strcpy(name, part);
strcpy(part, "Titanium.exe");
wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
if (!((hSearch = FindFirstFile(tmp, &wfd)) == INVALID_HANDLE_VALUE))
do
{
if (!strncmp(wfd.cFileName, ".", 1) || !strncmp(wfd.cFileName, "..", 2))
continue;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
char next[MAX_PATH];
if(GetFullPathName(lpszFileName, MAX_PATH, next, &part) == 0) return FALSE;
strcpy(part, wfd.cFileName);
strcat(next, "\\");
strcat(next, name);
SearchFiles(next, lpSearchFunc, TRUE);
}
}
while (FindNextFile(hSearch, &wfd));
FindClose (hSearch);
}
if ((hSearch = FindFirstFile(lpszFileName, &wfd)) == INVALID_HANDLE_VALUE)
return TRUE;
do
if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
char file[MAX_PATH];
if(GetFullPathName(lpszFileName, MAX_PATH, file, &part) == 0) return FALSE;
strcpy(part, wfd.cFileName);
lpSearchFunc(file);
}
while (FindNextFile(hSearch, &wfd));
FindClose (hSearch);
return TRUE;
}
}