Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

Как реализовать нечто похожее на FindFirst у ПАСКАЛЯ

4.0K
07 июля 2003 года
laplas
4 / / 07.07.2003
Как реализовать нечто похожее на FindFirst и FindNext на C/C++
4.5K
07 июля 2003 года
Frozik
10 / / 07.07.2003
Цитата:
Originally posted by laplas
лБЛ ТЕБМЙЪПЧБФШ ОЕЮФП РПИПЦЕЕ ОБ FindFirst Й FindNext ОБ C/C++


Для какой ОС?

4.0K
08 июля 2003 года
laplas
4 / / 07.07.2003
Цитата:
Originally posted by Frozik

дМС ЛБЛПК пу?


for dos/windows konechno

4.5K
08 июля 2003 года
Frozik
10 / / 07.07.2003
Цитата:
Originally posted by laplas

for dos/windows konechno



с использованием MFC

CFileFind


The MFC class CFileFind performs local file searches and is the base class for CGopherFileFind and CFtpFileFind, which perform Internet file searches. CFileFind includes member functions that begin a search, locate a file, and return the title, name, or path of the file. For Internet searches, the member function GetFileURL returns the file’s URL.

CFileFind is the base class for two other MFC classes designed to search particular server types: CGopherFileFind works specifically with gopher servers, and CFtpFileFind works specifically with FTP servers. Together, these three classes provide a seamless mechanism for the client to find files, regardless of the server protocol, the file type, or location, on either a local machine or a remote server.

The following code will enumerate all the files in the current directory, printing the name of each file:

CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
cout << (LPCTSTR) finder.GetFileName() << endl;
}

To keep the example simple, this code uses the standard C++ library cout class. The cout line could be replaced with a call to CListBox::AddString, for example, in a program with a graphical user interface.

For more information about how to use CFileFind and the other WinInet classes, see the articleInternet Programming with WinInet in Visual C++ Programmer's Guide.

#include <afx.h>

4.5K
08 июля 2003 года
Frozik
10 / / 07.07.2003
Цитата:
Originally posted by laplas

for dos/windows konechno



А вот апишные функции

FindFirstFile
The FindFirstFile function searches a directory for a file whose name matches the specified file name. FindFirstFile examines subdirectory names as well as file names.

To specify additional attributes to be used in the search, use the FindFirstFileEx function.

HANDLE FindFirstFile(
LPCTSTR lpFileName, // file name
LPWIN32_FIND_DATA lpFindFileData // data buffer
);
Parameters
lpFileName
[in] Pointer to a null-terminated string that specifies a valid directory or path and file name, which can contain wildcard characters (* and ?). If the string ends with a wildcard, a period, or a directory name, the user must have access to the root and all subdirectories on the path.
Windows NT/2000 or later: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.

Windows 95/98/Me: This string must not exceed MAX_PATH characters.

lpFindFileData
[out] Pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory.
Return Values
If the function succeeds, the return value is a search handle used in a subsequent call to FindNextFile or FindClose.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.



FindFirstFileEx
The FindFirstFileEx function searches a directory for a file whose name and attributes match those specified in the function call.

HANDLE FindFirstFileEx(
LPCTSTR lpFileName, // file name
FINDEX_INFO_LEVELS fInfoLevelId, // information level
LPVOID lpFindFileData, // information buffer
FINDEX_SEARCH_OPS fSearchOp, // filtering type
LPVOID lpSearchFilter, // search criteria
DWORD dwAdditionalFlags // reserved
);
Parameters
lpFileName
[in] Pointer to a null-terminated string that specifies a valid directory or path and file name, which can contain wildcard characters (* and ?). If the string ends with a wildcard, a period, or a directory name, the user must have access to the root and all subdirectories on the path.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.

fInfoLevelId
[in] Specifies a FINDEX_INFO_LEVELS enumeration type that gives the information level of the returned data.
lpFindFileData
[out] Pointer to the buffer that receives the file data. The pointer type is determined by the level of information specified in the fInfoLevelId parameter.
fSearchOp
[in] Specifies a FINDEX_SEARCH_OPS enumeration type that gives the type of filtering to perform beyond wildcard matching.
lpSearchFilter
[in] If the specified fSearchOp needs structured search information, lpSearchFilter points to the search criteria. At this time, none of the supported fSearchOp values require extended search information. Therefore, this pointer must be NULL.
dwAdditionalFlags
Reserved for future use. This parameter must be zero.
Return Values
If the function succeeds, the return value is a search handle that can be used in a subsequent call to the FindNextFile or FindClose functions.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.



FindNextFile
The FindNextFile function continues a file search from a previous call to the FindFirstFile function.

BOOL FindNextFile(
HANDLE hFindFile, // search handle
LPWIN32_FIND_DATA lpFindFileData // data buffer
);
Parameters
hFindFile
[in] Search handle returned by a previous call to the FindFirstFile function.
lpFindFileData
[out] Pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory. The structure can be used in subsequent calls to FindNextFile to refer to the found file or directory.
Return Values
If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. If no matching files can be found, the GetLastError function returns ERROR_NO_MORE_FILES.

4
08 июля 2003 года
mike
3.7K / / 01.10.2002
NAME
opendir - open a directory

SYNOPSIS
#include <sys/types.h>

#include <dirent.h>

DIR *opendir(const char *name);

DESCRIPTION
The opendir() function opens a directory stream corresponding to the directory name, and returns a pointer to
the directory stream. The stream is positioned at the first entry in the directory.

RETURN VALUE
The opendir() function returns a pointer to the directory stream or NULL if an error occurred.

ERRORS
EACCES Permission denied.

EMFILE Too many file descriptors in use by process.

ENFILE Too many files are currently open in the system.

ENOENT Directory does not exist, or name is an empty string.

ENOMEM Insufficient memory to complete the operation.

ENOTDIR
name is not a directory.

CONFORMING TO
SVID 3, POSIX, BSD 4.3

SEE ALSO
open(2), readdir(3), closedir(3), rewinddir(3), seekdir(3), telldir(3), scandir(3)
724
10 июля 2003 года
_anton
100 / / 04.11.2002
Описаны в io.h , как и многое другое для работы с файлами.

_findfirst(const char *, struct _finddata_t *);
_findnext(long, struct _finddata_t *);
_findclose(long);
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог