_findfirsti64, _wfindfirsti64
io.h:インデックス への移動
ヘッダーファイル
io.h, wchar.h
カテゴリ
ディレクトリ制御ルーチン
プロトタイプ
long _findfirsti64(char *filter, struct _finddatai64_t *fileinfo);
long _wfindfirsti64(wchar_t *filter, struct _wfinddatai64_t *fileinfo);
説明
ディスクのディレクトリの検索を開始し,指定されたフィルタに一致する最初のファイル名に関する情報を見つけます。この filter パラメータは,取得するファイルを指定する文字列です。フィルタには,ワイルドカードを使用できます。fileinfo パラメータは,ファイル情報のバッファです。一致するファイルが見つかると,fileinfo 構造体にファイルディレクトリ情報が格納されます。
これらの i64 バージョンは,64 ビットのファイルサイズ用で,Microsoft との互換性のために提供されています。
戻り値
成功した場合は,フィルタ指定に一致するファイルまたはファイルグループを識別する一意の検索ハンドルを返します。
そうでない場合は -1 を返し,errno を次のいずれかの値に設定します。
ENOENT - ファイル指定が一致しない
EINVAL - ファイル名の指定が無効
コード例
#include <io.h> void print_dir(wchar_t* dir_name) { /* Open a find stream (_wfinddatai64_t and a find handle) */ _wfinddatai64_t find_data; long handle = _wfindfirsti64(dir_name, &find_data); /* Check for errors */ if (!handle) return; /* Scan all files that mach */ do { printf("%ls\n", find_data.name); } while (!_wfindnexti64(handle, &find_data)); /* Close the find handle */ _findclose(handle); }
移植性
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
_findfirsti64 |
+ |
|||
_wfindfirsti64 |
NT のみ |