Struct winsafe::HFINDFILE [−][src]
#[repr(C)]pub struct HFINDFILE { /* fields omitted */ }
Expand description
Handle to a
file search.
Originally just a HANDLE
.
Implementations
Creates a new handle instance by wrapping a pointer.
This method is common to all handle types.
Consumes the handle returning the underlying raw pointer.
This method is common to all handle types.
Tells if the handle is invalid (null).
This method is common to all handle types.
pub fn FindFirstFile(
file_name: &str,
wfd: &mut WIN32_FIND_DATA
) -> WinResult<(HFINDFILE, bool)>
pub fn FindFirstFile(
file_name: &str,
wfd: &mut WIN32_FIND_DATA
) -> WinResult<(HFINDFILE, bool)>
FindFirstFile
static method.
Note: Must be paired with an
HFINDFILE::FindClose
call.
Examples
Enumerating all TXT files in a directory:
ⓘ
use winsafe::{HFINDFILE, WIN32_FIND_DATA};
let mut wfd = WIN32_FIND_DATA::default();
let (hfind, mut found) = HFINDFILE::FindFirstFile(
"C:\\Temp\\*.txt",
&mut wfd,
)?;
if found {
while found {
println!("File: {}", wfd.cFileName());
found = hfind.FindNextFile(&mut wfd)?;
}
hfind.FindClose()?;
}
FindNextFile
method.
Wrapper to FindFirstFile
,
FindNextFile
and
FindClose
, performing all needed
operations and returning the full paths of all found files.
Examples
Enumerating all TXT files in a directory:
ⓘ
use winsafe::HFINDFILE;
let files = HFINDFILE::ListAll("C:\\Temp\\*.txt")?;
for file in files.iter() {
println!("File: {}", file);
}
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more