# ft\_putchar\_fd

### Subject

{% code overflow="wrap" %}

```
FT_PUTCHAR_FD (simplified)

NAME
    ft_putchar_fd -- write character c on a specified file descriptor
SYNOPSIS
    void ft_putchar_fd(char c, int fd);
DESCRIPTION
    The ft_putchar_fd() function writes the character c on the file descriptor fd.
PARAMETERS
    c: character to write
    fd: file descriptor on which to write
RETURN VALUES
    ft_putchar_fd() does not return anything.
AUTHORIZED EXTERNAL FUNCTIONS
    write(2)
```

{% endcode %}

### Understandable explanation

This one is pretty straight forward, you already know how to write the `ft_putchar()` function, if you don't remember, look back at what you did during your Piscine.

### Hints

Take a look at the man for the `write(2)` function, the first parameter is... you guessed it ! A file descriptor, so I mean, do you really need to have the code for this ?

I hope you can figure it out.

### Commented solutions

<details>

<summary>ft_putchar_fd</summary>

{% code title="ft\_putchar\_fd.c" overflow="wrap" lineNumbers="true" %}

```c
#include "libft.h"

void    ft_putchar_fd(char c, int fd)
{
    /* first parameter is the file descriptor
     * second parameter is the address to the character
     */
    write(fd, &c, 1);
}
```

{% endcode %}

</details>


---

# Agent Instructions: 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:

```
GET https://42-cursus.gitbook.io/guide/0-rank-00/libft/additional-functions/ft_putchar_fd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
