Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
17
Task/Unix-ls/Rust/unix-ls.rust
Normal file
17
Task/Unix-ls/Rust/unix-ls.rust
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use std::os;
|
||||
use std::io::fs;
|
||||
|
||||
fn main() {
|
||||
let cwd = os::getcwd();
|
||||
let info = fs::readdir(&cwd).unwrap();
|
||||
|
||||
let mut filenames = Vec::new();
|
||||
for entry in info.iter() {
|
||||
filenames.push(entry.filename_str().unwrap());
|
||||
}
|
||||
|
||||
filenames.sort();
|
||||
for filename in filenames.iter() {
|
||||
println!("{}", filename);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue