Given the following environment
#include
#include
int main()
{
int filedes[2];
pipe(filedes);
// Code Fragment Goes Here
return 0;
}
Write a code fragment that duplicates and assigns the read file descriptor to the standard input and then closes the read file descriptor.
dup2(filedes[0], STDIN_FILENO);
close(filedes[0]);
You might also like to view...
Which of the following statements is false?
a. Each class declaration that begins with the access modifier private must be stored in a file that has the same name as the class and ends with the .java filename extension. b. Every class declaration contains keyword class followed immediately by the class’s name. c. Class, method and variable names are identifiers. d. An object has attributes that are implemented as instance variables and carried with it throughout its lifetime.
7. Suppose an array reptiles is ["snake", "turtle", "lizard"]. To add "crocodile" to the end of the array, use the statement ___.
A. reptiles.push("crocodile"); B. reptiles.push(); C. reptiles.pop("crocodile"); D. reptiles.pop(); E. reptiles.unshift("crocodile"); F. reptiles.unshift(); G. reptiles.shift("crocodile"); H. reptiles.shift();
What is Math.floor(3.6)?
A. 5.0 B. 4 C. 3 D. 2
In the figure above, which number identifies the type of window the form will open in?
A. 1 B. 2 C. 3 D. 4