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

in #programing3 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

Coin Marketplace

STEEM 0.21
TRX 0.25
JST 0.038
BTC 96989.50
ETH 3378.64
USDT 1.00
SBD 3.23