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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#define KILO_BYTE 1024 | |
#define AMOUNT 2 | |
#define LOOP 200 | |
int main() | |
{ |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <error.h> | |
#define READ 0 | |
#define WRITE 1 | |
#define MAX 1024 |
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 nix::unistd::{fork, ForkResult}; | |
// use nix::sys::wait::wait; | |
// use nix::sys::wait::WaitStatus; | |
use std::process; | |
fn main() { | |
let pid = fork(); | |
match pid { | |
Ok(ForkResult::Child) => { | |
println!("I'm a child with PID {}", process::id()); |
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::env; | |
use nix::unistd::fork; | |
use std::process; | |
fn main() { | |
let args: Vec<String> = env::args().collect(); | |
if args.len() < 2 { | |
eprintln!("Not enough argument"); | |
return; | |
} |
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 nix::unistd::fork; | |
fn main() { | |
println!("Before fork()"); | |
fork(); | |
println!("After fork()"); | |
} |
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
#include <signal.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
bool running = true; | |
void sigHandler(int number) { |
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
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <errno.h> | |
int main() { | |
char name[50]; | |
int fd = open("myoutput.txt", | |
O_WRONLY | O_CREAT | O_EXCL, |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#define READ 0 | |
#define WRITE 1 | |
#define MAX 1024 | |
int main () { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define SIZE 16 | |
int main() | |
{ | |
char *data1, *data2; | |
int k; |
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
#include <stdio.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <stdbool.h> | |
int number = 0; | |
bool running = true; | |
void do_nothing(int s) { |
NewerOlder