Rust language [2] How write text file (UTF8)

in programing •  3 years ago 

top_images.png

Trivial task.

We write a text file.

Rust 1.55

A bit of documentation:

https://doc.rust-lang.org/std/fs/fn.write.html
https://doc.rust-lang.org/std/fs/index.html

use std::fs;
fn main() {
    let content_hello = String::from("שָׁלוֹם ,Hello, Dobrý den, ﺎﻠﺳﻼﻣ ﻊﻠﻴﻜдравствуйте, नमस्ते, こんにちは)");
    fs::write("./hello.txt", content_hello).expect("some problems with save data");
}
check:
file -i ./hello.txt

Screenshot_2021-09-26_14-43-26.png

Some previous posts about the rust language:

https://steemit.com/programing/@grzesiekb/rust-language-1-how-read-text-file

Places where I also post information about Rust language challenges

https://www.facebook.com/rust.challenge

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!