Share via


_findnext, _findnext32, _findnext32i64, _findnext64, _findnext64i32, _findnexti64, _wfindnext, _wfindnext32, _wfindnext32i64, _wfindnext64, _wfindnext64i32, _wfindnexti64

尋找下一個名稱,如果有的話,符合 filespec 先前呼叫 _findfirst 中的 引數,然後據以改變 fileinfo 結構內容。

語法

int _findnext(
   intptr_t handle,
   struct _finddata_t *fileinfo
);
int _findnext32(
   intptr_t handle,
   struct _finddata32_t *fileinfo
);
int _findnext64(
   intptr_t handle,
   struct __finddata64_t *fileinfo
);
int _findnexti64(
   intptr_t handle,
   struct __finddatai64_t *fileinfo
);
int _findnext32i64(
   intptr_t handle,
   struct _finddata32i64_t *fileinfo
);
int _findnext64i32(
   intptr_t handle,
   struct _finddata64i32_t *fileinfo
);
int _wfindnext(
   intptr_t handle,
   struct _wfinddata_t *fileinfo
);
int _wfindnext32(
   intptr_t handle,
   struct _wfinddata32_t *fileinfo
);
int _wfindnext64(
   intptr_t handle,
   struct _wfinddata64_t *fileinfo
);
int _wfindnexti64(
   intptr_t handle,
   struct _wfinddatai64_t *fileinfo
);
int _wfindnext32i64(
   intptr_t handle,
   struct _wfinddatai64_t *fileinfo
);
int _wfindnext64i32(
   intptr_t handle,
   struct _wfinddata64i32_t *fileinfo
);

參數

handle
先前呼叫 所傳回的 _findfirst 搜尋控制碼。

fileinfo
檔案資訊緩衝區。

傳回值

如果成功, 會傳回 0。 否則,會傳回 -1,並將 設定 errno 為指出失敗本質的值。 下表顯示可能的錯誤碼。

errno 條件
EINVAL 參數無效:fileinfoNULL。 或者,作業系統傳回未預期的錯誤。
ENOENT 無法再找到相符檔案。
ENOMEM 記憶體不足,或檔名的長度超過 MAX_PATH

如果傳入不正確參數,這些函式會叫用不正確參數處理常式,如參數驗證 中所述

備註

您必須在使用 _findfirst_findnext 函式 (或任何變體) 完成之後呼叫 _findclose_findclose 釋放應用程式中這些函式所使用的資源。

具有 w 前置詞的這些函式變化是寬字元版本;否則,它們與對應的單一位元組函式相同。

這些函式的變化支援 32 位元或 64 位元時間類型,以及 32 位元或 64 位元檔案大小。 第一個數值後置字元 (3264) 表示所使用的時間類型大小,第二個後置字元為 i32i64,表示檔案大小是以 32 位元或 64 位元整數來表示。 如需支援 32 位元和 64 位元時間類型與檔案大小之版本的資訊,請參閱下表。 使用 64 位元時間類型的變化可將檔案建立日期最高表示為 3000 年 12 月 31 日 23:59:59 UTC;而使用 32 位元時間類型的變化僅代表到 2038 年 1 月 18 日 23:59:59 UTC 的日期。 1970 年 1 月 1 日午夜是所有這些函式的日期範圍下限。

除非您有特定原因要使用明確指定時間大小的版本,否則請使用 _findnext_wfindnext或者,如果您需要支援大於 3 GB 的檔案大小,請使用 _findnexti64_wfindnexti64。 所有這些函式都使用 64 位元時間類型。 在舊版本中,這些函式都是使用 32 位元時間類型。 如果這項變更是應用程式的中斷性變更,您可能會定義 _USE_32BIT_TIME_T 以取得舊的行為。 如果定義 _USE_32BIT_TIME_T_findnext_findnexti64 和其對應的 Unicode 版本會使用 32 位元時間。

根據預設,此函式的全域狀態會限定于應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。

_findnext 的時間類型和檔案長度類型變化

函式 已定義 _USE_32BIT_TIME_T 嗎? 時間類型 檔案長度類型
_findnext, _wfindnext 未定義 64 位元 32 位元
_findnext, _wfindnext 已定義 32 位元 32 位元
_findnext32, _wfindnext32 不會受到巨集定義的影響 32 位元 32 位元
_findnext64, _wfindnext64 不會受到巨集定義的影響 64 位元 64 位元
_findnexti64, _wfindnexti64 未定義 64 位元 64 位元
_findnexti64, _wfindnexti64 已定義 32 位元 64 位元
_findnext32i64, _wfindnext32i64 不會受到巨集定義的影響 32 位元 64 位元
_findnext64i32, _wfindnext64i32 不會受到巨集定義的影響 64 位元 32 位元

泛型文字常式對應

Tchar.h 常式 _UNICODE_MBCS 未定義 _MBCS 定義 _UNICODE 定義
_tfindnext _findnext _findnext _wfindnext
_tfindnext32 _findnext32 _findnext32 _wfindnext32
_tfindnext64 _findnext64 _findnext64 _wfindnext64
_tfindnexti64 _findnexti64 _findnexti64 _wfindnexti64
_tfindnext32i64 _findnext32i64 _findnext32i64 _wfindnext32i64
_tfindnext64i32 _findnext64i32 _findnext64i32 _wfindnext64i32

需求

函式 必要的標頭
_findnext <io.h>
_findnext32 <io.h>
_findnext64 <io.h>
_findnexti64 <io.h>
_findnext32i64 <io.h>
_findnext64i32 <io.h>
_wfindnext <io.h > 或 < wchar.h>
_wfindnext32 <io.h > 或 < wchar.h>
_wfindnext64 <io.h > 或 < wchar.h>
_wfindnexti64 <io.h > 或 < wchar.h>
_wfindnext32i64 <io.h > 或 < wchar.h>
_wfindnext64i32 <io.h > 或 < wchar.h>

如需相容性詳細資訊,請參閱相容性

程式庫

所有版本的 C 執行階段程式庫

另請參閱

系統呼叫
檔案名搜尋函式