# file_write

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L292
- **Page:** https://libtmux.org/en/tmux/latest/reference/c-function-file_write/

```c
void file_write(struct client *c, const char *path, int flags, const void *bdata, size_t bsize, client_file_cb cb, void *cbdata)
```

## Parameters

- `c` (`struct client *`)
- `path` (`const char *`)
- `flags` (`int`)
- `bdata` (`const void *`)
- `bsize` (`size_t`)
- `cb` (`client_file_cb`)
- `cbdata` (`void *`)

## Called by

- [`cmd_save_buffer_exec`](/en/tmux/latest/reference/c-function-cmd-save-buffer-c-cmd_save_buffer_exec/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-save-buffer.c#L115)

## Calls

- [`file_create_with_client`](/en/tmux/latest/reference/c-function-file_create_with_client/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L304)
- [`file_fire_done`](/en/tmux/latest/reference/c-function-file_fire_done/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L361)
- [`file_get_path`](/en/tmux/latest/reference/c-function-file-c-file_get_path/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L318)
- [`proc_send`](/en/tmux/latest/reference/c-function-proc_send/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L352)
- [`xmalloc`](/en/tmux/latest/reference/c-function-xmalloc/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L347)
- [`xstrdup`](/en/tmux/latest/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/file.c#L305)

## Referenced declarations

- [`client_file.buffer`](/en/tmux/latest/reference/c-struct-client_file-buffer/) (attribute)
- [`client`](/en/tmux/latest/reference/c-struct-client/) (struct)
- [`CLIENT_ATTACHED`](/en/tmux/latest/reference/c-define-tmux-h-client_attached/) (constant)
- [`CLIENT_CONTROL`](/en/tmux/latest/reference/c-define-tmux-h-client_control/) (constant)
- [`client_file_cb`](/en/tmux/latest/reference/c-typedef-client_file_cb/) (typealias)
- [`client_file.error`](/en/tmux/latest/reference/c-struct-client_file-error/) (attribute)
- [`msg_write_open.fd`](/en/tmux/latest/reference/c-struct-msg_write_open-fd/) (attribute)
- [`file_next_stream`](/en/tmux/latest/reference/c-variable-file-c-file_next_stream/) (attribute)
- [`client.flags`](/en/tmux/latest/reference/c-struct-client-flags/) (attribute)
- [`msg_write_open.flags`](/en/tmux/latest/reference/c-struct-msg_write_open-flags/) (attribute)
- [`MSG_WRITE_OPEN`](/en/tmux/latest/reference/c-enum-msgtype-msg_write_open/) (constant)
- [`client_file.path`](/en/tmux/latest/reference/c-struct-client_file-path/) (attribute)
- [`client_file.peer`](/en/tmux/latest/reference/c-struct-client_file-peer/) (attribute)
- [`client_file.stream`](/en/tmux/latest/reference/c-struct-client_file-stream/) (attribute)
- [`msg_write_open.stream`](/en/tmux/latest/reference/c-struct-msg_write_open-stream/) (attribute)
