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

int main() {
	int fileDes[2];
	if (pipe(fileDes) < 0) {
		perror("pipe");
		return 1;
	}
	if (close(fileDes[1]) < 0) {
		perror("close");
		return 2;
	}
	char buf;
	read(fileDes[0], &buf, 1);
	printf("%c", buf);
	return 0;
}