std::setvbuf - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::setvbuf

From cppreference.com
< cpp‎ | io‎ | c

Defined in header `<cstdio>` |  |
int setvbuf( std::FILE* stream, char* buffer, int mode, std::size_t size ); |  |

Sets the internal buffer of the given file stream `stream`.

### [edit] Parameters

stream | - | the file stream to set the buffer to
buffer | - | pointer to a buffer for the stream to use
mode | - | buffering mode to use. It can be one of the following values:
`_IOFBF` | full buffering
`_IOLBF` | line buffering
`_IONBF` | no buffering
size | - | size of the buffer

### [edit] Return value

​0​ on success or nonzero on failure.

### [edit] Notes

This function may only be used after `stream` has been associated with an open file, but before any other operation.

`buffer` may be null, in which case this call only resizes the internal buffer.

### [edit] See also

setbuf | sets the buffer for a file stream (function) [edit]
setbuf [virtual] | provides user-supplied buffer or turns this filebuf unbuffered (virtual protected member function of `std::basic_filebuf`) [edit]
C documentation for setvbuf

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/io/c/setvbuf&oldid=67583"