官术网_书友最值得收藏!

  • Learning Rust
  • Paul Johnson Vesa Kaihlavirta
  • 94字
  • 2021-07-02 23:07:22

Reading from a file

Here, we are going to use std::io, std::io::prelude::* and std::fs::File. std::io is the standard input/output library, the * after prelude means to use anything in the prelude library, and std::fs is the filesystem library.

Filesystem calls are very platform-specific; Windows users use the likes of C://Users/Paul/Documents/My Documents for the user's home directory, whereas Linux and macOS machines would use ~/ for the user's home directory. If a path is not given for a file, the program will assume the file is in the same directory in which the binary resides.

主站蜘蛛池模板: 岢岚县| 乐平市| 玉门市| 安庆市| 定陶县| 毕节市| 托克托县| 马公市| 定南县| 卢龙县| 来宾市| 资中县| 东丰县| 乡宁县| 诸暨市| 旌德县| 定结县| 大同市| 宣汉县| 赤水市| 调兵山市| 仙居县| 汉阴县| 双峰县| 云龙县| 广元市| 万山特区| 安岳县| 清苑县| 仁化县| 平昌县| 西贡区| 滨州市| 江达县| 罗平县| 高雄县| 宁南县| 库车县| 贵溪市| 海门市| 东乌|