Question: Please, have a look at this sample code which is using a very well established programming pattern to redirect `stdout` to a pipe.

```
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    int fd[2];
    pipe(fd);

    pid_t pid = fork();
    if (pid == 0) {
        close(fd[0]);
        dup2(fd[1], 1);
        printf("A string");
        _exit(0);
    }

    close(fd[1]);
    char text[1000];
    size_t size;
    int p = 0;
    while ((size = read(fd[0], text+p, 1)) == 1) {
        p++;
    }
    close(fd[0]);
    text[p] = '\0';
    printf("%s", text);

    return 0;
}

```

The code, as it is, is not working. As correctly suggested in a comment by @kaylum, calling `exit` instead of `_exit` in the child process makes the code working properly.

Answer: 
`exit` is a C-level function that flushes and then closes every C-level streams (stdin, stdout and stderr are C-level streams).

`_exit` is a POSIX-level function that closes every system-level streams (descriptors like 0, 1, 2, etc are system-level streams). In this case, buffering is an system internal concern.

You've made a redirection to let `printf` (C-level function) finally writes to descriptor 1 (system-level), but `printf` buffers while buffer is not full and the C-string does not contains `\n` (it is your case). Then terminating by a call to `_exit` will simply lost the unflushed buffer content.

On POSIX systems, `exit` flushes every C-stream and then call `_exit` (which in turn closes every system-stream before really terminating the execution).
Usually \_ is reserved for implementations. \_Exit was introtuced with C99, so you probably have to use a switch to make your coompiler conform to C99.