There are 3 types of buffering:
i)Block buffered
many characters are saved upto a buffer size written to destination as a block
ii)Line buffered
characters are saved till a new line character is found & written to destination
iii)unbuffered
the output appears on destination as soon as it is written
By default BUFSIZ is used for any stream if buffer is null or not specified.
fflush can be used to flush out a stream:
stdout - write the data in buffer to output stream
stdin - discards any buffered data in stream
return 0 on success
setvbuf(FILE *stream, char *buff, mode, sizeof(buff))
i)Block buffered
many characters are saved upto a buffer size written to destination as a block
ii)Line buffered
characters are saved till a new line character is found & written to destination
iii)unbuffered
the output appears on destination as soon as it is written
By default BUFSIZ is used for any stream if buffer is null or not specified.
fflush can be used to flush out a stream:
stdout - write the data in buffer to output stream
stdin - discards any buffered data in stream
return 0 on success
setvbuf(FILE *stream, char *buff, mode, sizeof(buff))
No comments:
Post a Comment