Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/types.h>
- int main(){
- int potok_fd[2] ,licznik ,obraz ,pid;
- char bufor[64] ,nazwa[32];
- pipe(potok_fd); // tworzenie potoku
- pid = fork(); // tworzeine procesu potomnego
- if (pid == 0) // fragment kodu zrodlowego zaczerpniety z wykladu Dr. W. Paluszynskiego
- {
- close(0); //zamkniecie wejścia
- dup(potok_fd[0]);
- close(potok_fd[0]);
- close(potok_fd[1]);
- close(1);
- execlp("display","display",NULL);
- }
- close(potok_fd[0]);
- printf("Wprowadz nazwe obrazu: ");
- scanf("%s",nazwa);
- obraz=open(nazwa,O_RDONLY);
- while ((licznik=read(obraz, bufor, 64)) > 0)
- write(potok_fd[1], bufor, licznik);
- close(potok_fd[1]);
- return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement