9 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

new 0.5.1 Nov 7, 2019
0.5.0 May 31, 2019
0.4.0 Apr 22, 2019
0.2.3 May 31, 2016
0.1.0 Apr 29, 2016

#50 in Unix APIs

Download history 155/week @ 2019-07-25 13/week @ 2019-08-01 17/week @ 2019-08-08 106/week @ 2019-08-15 64/week @ 2019-08-22 13/week @ 2019-08-29 29/week @ 2019-09-05 12/week @ 2019-09-12 44/week @ 2019-09-19 10/week @ 2019-09-26 33/week @ 2019-10-03 2/week @ 2019-10-10 36/week @ 2019-10-17 17/week @ 2019-10-24 18/week @ 2019-10-31

133 downloads per month
Used in 2 crates

MIT license

38KB
813 lines

rust-cfile crates.io docs travis Build status dependency status

Rust bindings to C *FILE stream

Examples

use std::io::prelude::*;
use std::io::{BufReader, SeekFrom};

use cfile;

// open a tempfile
let mut f = cfile::tmpfile().unwrap();

// write something to the stream
assert_eq!(f.write(b"test").unwrap(), 4);

// force to flush the stream
f.flush().unwrap();

// seek to the beginning of stream
assert_eq!(f.seek(SeekFrom::Start(0)).unwrap(), 0);

let mut r = BufReader::new(f);
let mut s = String::new();

// read back the text
assert_eq!(r.read_line(&mut s).unwrap(), 4);
assert_eq!(s, "test");

Dependencies

~0.6–1MB
~21K SLoC