• Ogłoszenie:

What does this c program with pipes do?

Dyskusje i problemy z Unix'ami

What does this c program with pipes do?

Postprzez MahishTanzon 18 Kwi 2023, 12:10

reklama
I have a program that creates two child processes for two comparison methods (by dictionary and by length), but when I try to get the answer from one of the pipes (there are two pipes for each process), the function takes me out of the loop. The program creates four pipes and forks two child processes to run the two comparison methods. The parent process takes user input and sends it to the child processes for comparison.

Here is an overview of the program:

The program initializes four pipes and forks two child processes, one for each comparison method. The parent process then takes user input for two strings and prompts the user to choose a comparison method. If the user chooses the dictionary method, the parent process writes the two strings to the pipe associated with the first child process and reads the result from the second pipe. If the user chooses the length method, the parent process writes the two strings to the pipe associated with the second child process and reads the result from the third pipe. The loop continues until there is no input.
MahishTanzon
~user
 
Posty: 28
Dołączenie: 29 Gru 2022, 15:04



Powróć do System Linux / Unix

Kto jest na forum

Użytkownicy przeglądający to forum: Brak zarejestrowanych użytkowników oraz 2 gości