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

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