Skip to content
Snippets Groups Projects
Commit e73678d8 authored by Tom Almeida's avatar Tom Almeida
Browse files

Added a FileReader struct

parent f20878c5
No related branches found
No related tags found
No related merge requests found
......@@ -57,8 +57,8 @@ pub unsafe fn c_str_n(s: *const c_char, n: usize) -> &'static [u8] {
pub struct FileWriter(pub c_int);
impl FileWriter {
pub fn write(&mut self, buf: &[u8]) {
write(self.0, buf);
pub fn write(&mut self, buf: &[u8]) -> isize {
write(self.0, buf)
}
}
......@@ -69,6 +69,14 @@ impl fmt::Write for FileWriter {
}
}
pub struct FileReader(pub c_int);
impl FileReader {
pub fn read(&mut self, buf: &mut [u8]) -> isize {
read(self.0, buf)
}
}
pub struct StringWriter(pub *mut u8, pub usize);
impl StringWriter {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment