summaryrefslogtreecommitdiffstats
path: root/vendor/bstr/examples/uppercase-std.rs
blob: 672bd717124d4b143aded809e5d2e9066bc59bbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::error::Error;
use std::io::{self, BufRead, Write};

fn main() -> Result<(), Box<dyn Error>> {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();
    let mut stdout = io::BufWriter::new(io::stdout());

    let mut line = String::new();
    while stdin.read_line(&mut line)? > 0 {
        stdout.write_all(line.to_uppercase().as_bytes())?;
        line.clear();
    }
    Ok(())
}