diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-24 23:27:20 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-28 23:13:02 -0800 |
| commit | 94d71f8836b3bfac3370e4d324ca1987d843552f (patch) | |
| tree | bf0f534115ebc644407e2b6b0c74ad6a027fa0c1 /src/libstd/sys/windows/c.rs | |
| parent | 8a69110c3b1122596ddc8999bb2403a5777bb8ed (diff) | |
| download | rust-94d71f8836b3bfac3370e4d324ca1987d843552f.tar.gz rust-94d71f8836b3bfac3370e4d324ca1987d843552f.zip | |
std: Implement stdio for `std::io`
This is an implementation of RFC 899 and adds stdio functionality to the new
`std::io` module. Details of the API can be found on the RFC, but from a high
level:
* `io::{stdin, stdout, stderr}` constructors are now available. There are also
`*_raw` variants for unbuffered and unlocked access.
* All handles are globally shared (excluding raw variants).
* The stderr handle is no longer buffered.
* All handles can be explicitly locked (excluding the raw variants).
The `print!` and `println!` machinery has not yet been hooked up to these
streams just yet. The `std::fmt::output` module has also not yet been
implemented as part of this commit.
Diffstat (limited to 'src/libstd/sys/windows/c.rs')
| -rw-r--r-- | src/libstd/sys/windows/c.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 2d1a5e10bd6..8ed7302b665 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -48,6 +48,11 @@ pub const WSAESHUTDOWN: libc::c_int = 10058; pub const ERROR_NO_MORE_FILES: libc::DWORD = 18; pub const TOKEN_READ: libc::DWORD = 0x20008; +// Note that these are not actually HANDLEs, just values to pass to GetStdHandle +pub const STD_INPUT_HANDLE: libc::DWORD = -10; +pub const STD_OUTPUT_HANDLE: libc::DWORD = -11; +pub const STD_ERROR_HANDLE: libc::DWORD = -12; + #[repr(C)] #[cfg(target_arch = "x86")] pub struct WSADATA { @@ -427,6 +432,7 @@ extern "system" { DesiredAccess: libc::DWORD, TokenHandle: *mut libc::HANDLE) -> libc::BOOL; pub fn GetCurrentProcess() -> libc::HANDLE; + pub fn GetStdHandle(which: libc::DWORD) -> libc::HANDLE; } #[link(name = "userenv")] |
