Note that there are some explanatory texts on larger screens.

plurals
  1. POProgram executes but not all, I don't know what this error means
    primarykey
    data
    text
    <p>this program will create a father and 2 childs, there will be a chain characters, the father will fill 2 pipes, the first with the numbers, the second with the letters, the first child will read from the first pipe, and return how much numbers he got, the second son will read from the second pipe, and return how much letters he got.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; #include &lt;string.h&gt; #include &lt;fcntl.h&gt; main() { printf("I am the father, I will create 2 sons, the first will read the numbers , the second will read the letters\n"); char *word="alibas123sam"; printf("Now 2 pipes will be created\n"); int fd1[2]; int fd2[2]; pipe(fd1); pipe(fd2); printf("Now the father will write numbers in the first pipe, and letters in the second\n"); int i; char numbers[20]; int j=0; char caracters[20]; int k=0; for (i=0;i&lt;20;i++) { if(word[i]&gt;='0' &amp;&amp; word[i]&lt;='9') //if number { close(fd1[0]); //closing reading write(fd1[1],&amp;word[i],1); } else { close(fd2[0]); write(fd2[1],&amp;word[i],1); } } printf("The father has wrote in the 2 pipes, now its time for the sons\n"); int f=fork(); if(f==0) //first son { for(i=0;i&lt;20;i++) { close(fd1[1]); //closing writing read(fd1[0],&amp;numbers[j],1); j++; } printf("first son read everything, he got %d Numbers\n", j); } else { f=fork(); if(f==0) { for(i=0;i&lt;20;i++) { close(fd2[1]); //closing writing read(fd2[0],&amp;caracters[k],1); k++; } printf("second son read everything, he got %d caracters\n", k); } }} </code></pre> <p>Error:</p> <pre><code>Disallowed system call: SYS_pipe </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload