Created
May 12, 2023 21:28
-
-
Save medigor/4338da72e886c09ee3825793a52dce38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
fs::File, | |
io::Write, | |
os::fd::{FromRawFd, IntoRawFd}, | |
}; | |
fn main() { | |
let mut f = unsafe { File::from_raw_fd(0) }; | |
f.write_all(b"Hello, world!\n").unwrap(); | |
//std::mem::forget(f); | |
f.into_raw_fd(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment