参考:https://stackoverflow.com/questions/41210691/how-to-check-for-eof-in-read-line-in-rust-1-12
如果read_line返回的是Ok(0)那么就是EOF了。
跟空行的区别在于空行实际上还有一个换行符,所以是Ok(1)。
let mut input = String::new(); |
参考:https://stackoverflow.com/questions/41210691/how-to-check-for-eof-in-read-line-in-rust-1-12
如果read_line返回的是Ok(0)那么就是EOF了。
跟空行的区别在于空行实际上还有一个换行符,所以是Ok(1)。
let mut input = String::new(); |
Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
©2021-
searchstar
|
pv
|
uv
Theme Tree
by Wu Jun
Powered by Hexo