> For the complete documentation index, see [llms.txt](https://42-cursus.gitbook.io/guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://42-cursus.gitbook.io/guide/2-rank-02/pipex/building-the-thing.md).

# Building the thing

{% hint style="warning" %}
Draw the pipes on paper, this helps, a lot. Before writing to the outfile, make sure you read from the correct end of the correct pipe.
{% endhint %}

Here I'll give you some checklist on what you have to do to achieve this project. All the code for my pipex is available on my [Github](https://github.com/Laendrun/42-pipex), if you have any question, don't hesitate to [contact](/guide/team.md) me (Simon), it'll be a pleasure to help you.

### Main checklist

* [ ] Check the existence of `infile` and `outfile`
  * [ ] be sure to understand what `>` does when the file does not exist
* [ ] Create the necessary pipe (or pipes)
* [ ] Create a child process for each command
* [ ] Wait for all the processes to end before writing to the outfile

{% hint style="warning" %}
When using `here_doc`, the second argument is not a command ;)
{% endhint %}

### Execute checklist

Remember that the `execve()` function needs the path to a binary file as parameter, so you'll have to find where the commands binaries are stored on your computer. Before going further, you have to know how to find any command binary.

* [ ] Check in all possible locations if the binary (command) requested by the user exists.
* [ ] "Build" the arguments array for the command.
* [ ] Execute the command using `execve()`

{% hint style="info" %}
I know this is pretty small, but you have the information you need, you have to search and try things by yourself or else you won't learn anything.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://42-cursus.gitbook.io/guide/2-rank-02/pipex/building-the-thing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
