blob: 4e59fe51887353b675225235ce93dac7a36e30ab [file] [log] [blame]
/* Read from a free'd file descriptor. */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
int *pipes;
char string[] = "String";
char buffer[sizeof(string)];
pipes = malloc(sizeof(int) * 2);
pipe(pipes);
write(pipes[1], string, sizeof(string));
free(pipes);
read(pipes[0], buffer, sizeof(buffer));
printf("%s\n", buffer);
return 0;
}