Quantcast
Viewing latest article 6
Browse Latest Browse All 7

Retrieving file/directory name from stdin

No need to use libc, the standard library abstracts that. I'd write something like this:

let fd = stdin().as_fd().try_clone_to_owned().unwrap();
let file = File::from(fd);
let meta = file.metadata().unwrap();
dbg!(meta.is_dir());

Read full topic


Viewing latest article 6
Browse Latest Browse All 7

Trending Articles