Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lif committed Feb 14, 2024
1 parent fa22699 commit 48aa1bb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ impl<O: AsyncWriteExt + Unpin + Send + AsRawFdHandle> Console<O> {
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::<VOID>(),
);
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::<VOID>(),
);
}
if res == 0 {
return Err(std::io::Error::last_os_error().into());
}
Expand Down

0 comments on commit 48aa1bb

Please sign in to comment.