diff --git a/src/lib.rs b/src/lib.rs index ac25617..17ae783 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -137,13 +137,15 @@ impl Console { use winapi::shared::minwindef::LPDWORD; use winapi::um::winnt::{HANDLE, VOID}; let mut _lp_num_of_chars_written = 0u32; - let res = winapi::um::consoleapi::WriteConsoleA( - self.stdout.as_raw_handle() as HANDLE, - bytes.as_ptr() as *const VOID, - bytes.len() as u32, - (&mut _lp_num_of_chars_written) as LPDWORD, - std::ptr::null_mut::(), - ); + let res = unsafe { + winapi::um::consoleapi::WriteConsoleA( + self.stdout.as_raw_handle() as HANDLE, + bytes.as_ptr() as *const VOID, + bytes.len() as u32, + (&mut _lp_num_of_chars_written) as LPDWORD, + std::ptr::null_mut::(), + ); + } if res == 0 { return Err(std::io::Error::last_os_error().into()); }