What is the output of the following program?
#include
#include
#include
using namespace std;

int main() {
int fd1 = open("", O_RDONLY);
int fd2 = open("", O_RDONLY);
cout << "fd1 = " << fd1 << endl;
}
What output does the program produce?
A) fd1 = -1
B) fd1 = 0
C) fd1 = 1
D) Compilation error

Q&A Education