Last active
April 24, 2020 17:00
-
-
Save jonathanbeber/f9ba6a6e0cc56bd9aac721d2318810a5 to your computer and use it in GitHub Desktop.
Playing around with shell and its file descriptors
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
package main | |
import "os" | |
func main() { | |
my_file := os.NewFile(5, "doesn't matter!") | |
my_file.Write([]byte("hallo =)\n")) | |
} |
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; | |
use std::io::Write; | |
use std::os::unix::io::FromRawFd; | |
fn main() { | |
let mut my_file: File; | |
unsafe { | |
my_file = File::from_raw_fd(5); | |
} | |
my_file.write("hallo, wie gehts?\n".as_bytes()).unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment