int setvbuf ( FILE * stream, char * buffer, int mode, size_t size );
- stream
- Pointer to a FILE object that identifies an open stream.
- buffer
- User allocated buffer. Shall be at least size bytes long.
If set to a null pointer, the function automatically allocates a buffer.
- mode
- Specifies a mode for file buffering. Three special macro constants (_IOFBF, _IOLBF and _IONBF) are defined in <cstdio> to be used as the value for this parameter:
| _IOFBF | Full buffering: On output, data is written once the buffer is full (or flushed). On Input, the buffer is filled when an input operation is requested and the buffer is empty. |
| _IOLBF | Line buffering: On output, data is written when a newline character is inserted into the stream or when the buffer is full (or flushed),
whatever happens first. On Input, the buffer is filled up to the next
newline character when an input operation is requested and the buffer is
empty. |
| _IONBF | No buffering: No buffer is used. Each I/O operation is written as soon as possible. In this case, the buffer and size parameters are ignored. |
- size
-
Buffer size, in bytes.
If the buffer argument is a null pointer, this value may determine the size automatically allocated by the function for the buffer
0 comments:
Post a Comment