Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / System programming / Practice08 / ex2.c
blob: c8e783eb889ab03c29fa26a5472be99b91807096 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <signal.h>
#include <stdio.h>
#include <unistd.h>

void sigpipeHandle(int a) {
	printf("handler\n");
}

int main() {
	signal(SIGPIPE, sigpipeHandle);

	int filedes[2];
	pipe(filedes);
	close(filedes[0]);

	write(filedes[1], "aba\n", 4);
	write(1, "mnm\n", 4);

	return 0;
}