I need to simulate the Linux command "`cal -3`", which displays the calendar for 3 months side by side. What I need right now is to get my implementation, using pipes, working. I've been told that I can't use `fork()`, but rather I should use `dup2()`, `write()`, `read()` and `close()` to call `system("myCustomCommand")` three times. Right now my program does not display the calendar side by side. 

I am trying to use pipes and ran into a problem. Here is what I am trying: 

```
int pfd[2];
int p; //for pipe
int d; //for dup2
const int BSIZE = 256;
char buf[BSIZE];

p = pipe(pfd);
if (p == -1) { perror("pipe"); exit(EXIT_FAILURE); }
if (p == 0)
{
    d = dup2(pfd[1], 0);
    close(pfd[1]);
    nbytes = read (pfd[1], buf , BSIZE);
    close(pfd[0]);
    exit(EXIT_SUCCESS);
}
else
{
    close(pfd[0]);
    write(pfd[1], "test\n", BSIZE);
    close(pfd[1]);
    exit(EXIT_SUCCESS);
}

```

Unfortunately, this code does not display anything. Could you please help me out with this?